OK, that's 1/2 of my questions answered :-)
What build of MySQL did you install? 32bit or 64bit.
99% of the time people report errors with database connections, they're using 32bit DLL drivers against 64 bit lazarus. Before we look at code, I really want to rule this out.
Update: In your first question you specified MySQL 8.4, and that's in Program Files, not in Program Files (x86). Not conclusive, but I'm willing to suspect 64bit MySQL. So we can rule bitness out, at least for now.
OK, next question. As you said you copied the DLL across, did you copy across all dependencies, or just the one DLL? When i built my MySQL library, I needed to copy the following files as Libmysql.dll requires them:
"libmysql.dll"
"libprotobuf-lite.dll"
"libssl-3-x64.dll"
"libcrypto-3-x64.dll"
I suspect different installations will have different dependencies. In doubt, copy ALL Dlls. if that works, delete on by one :-)
However, I used Dependency Walker to work out which DLLs I needed.