Delphi XE2 dbExpress MySQL connection

Brian Hawk picture Brian Hawk · Sep 28, 2011 · Viewed 16.8k times · Source

No matter what I've tried, I couldn't make XE2 to connect to a MySQL with dbExpress. The problem has actually many faces. First, target MySQL is either 32- or 64-bits, which affects the libmysql.dll that comes with the MySQL installation, which seems to be misleading because XE2 IDE is a 32-bit application and it only accepts 32-bit DLLs. So I needed to use a 32-bit installation libmysql.dll, put it under Windows\System32 (or to the project's folder itself), and then set the Target compile platform to 32-bit in my project (so that it won't try to use 64-bit dbxmys.dll, just in case), still with no luck. All the combinations I tried resulted with this error: "DBX Error: Driver could not be properly initialized. Client library may be missing......."

Anyone who's able to make XE2 dbExpress connect to a MySQL server? I need your help. Thanks in advance.

Windows 7 64-bit (dev platform with XE2), MySQL 5.5.16 32-bit (installed on a remote XP 32-bit) / MySQL 5.1.54 64-bit (installed on a remote XP x64) (tried with both, by using their libmysql.dlls)

Answer

kodiz picture kodiz · Dec 15, 2011

the answer to your question is simple, install your mysql and copy libmysql.dll from your mysql bin as shown eg.(C:\Program Files\MySQL\MySQL Server 5.1\bin) and then go to the xe2 directory and open the bin too eg (C:\Program Files\Embarcadero\RAD Studio\9.0\bin) and paste it there over running the already libmysql.dll in it.