radstudio logo

Getting embarcadero dbexpress mysql working - DBX Error: Driver not initialized

Sometimes the simple things are harder than you expected and dbexpress probably comes under that category, it was less express than I had expected but once you figure things out it does work. Some of the problems were my fault while others took time due to the obscur nature of the errors returned by XE and XE2.

If you start by adding the TSQLConnect component, select the MySQL driver and configure your HostName, Database, UserName and Password you can try and connect, you will most likely strike the following error :-

Show Plain Text
Text code
  1. DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, of the wrong version, or the driver maybe be missing from the system path...

So once you figure out that your missing the libmysql.dll you might try and grab the latest MYSQL C Connector from dev.mysql.com, they are up to version 6.0.2 at the time of writing this, you'll get the same error above. I was getting a more obscure crash before XE2 Update 1 which I didn't note down at the time, that abstract error message took me a while to figure out and was related to the libmysql.dll version.

It would be nice if embarcadero provided a location where you could download the compatible libmysql.dll files that work with dbexpress, it is worth noting that the XE2 read me does come with the following note :-

Show Plain Text
Text code
  1. Supported Servers
  2. dbExpress
  3. ...
  4. MySQL 5.1, 5.0.27, 4.1* (Pro/Ent/Ult/Arch) (Driver dbxMYS.dll, Client libmysql.dll)
  6. The following combinations have been tested:
  7. LibMySQL.dll (5.1.XX)  DBXMys.dll  MySQL 4.0.XX Server  
  8. LibMySQL.dll (5.1.XX)  DBXMys.dll  MySQL 4.0.XX Server  
  9. LibMySQL.dll (5.1.XX)  DBXMys.dll  MySQL 5.0.XX Server  
  10. LibMySQL.dll (5.1.XX)  DBXMys.dll  MySQL 5.1.XX Server

To get a 5.1.XX compatible DLL you will need to download an achieved mysql complete installation zip and extract the DLL as no compatible versioned MYSQL C Connector package could be downloaded when I looked.

To save you some time I added zip download containing the win32 x86 libmysql.dll for those who wish to download.

This is libmysql.dll version 5.1.59 win32 x86 DLL which I have tested and works with both XE and XE2.

50 Responses to “Getting embarcadero dbexpress mysql working - DBX Error: Driver not initialized”

Thank you!

Thank you very much, you saved me. I was having the same problem. I downloaded the libmysql.lib in the above link and now it works. Thank you 1000 times.


I continue with the problem. (I'm running Embarcadero ® Version RadPHP ™ XE2 in Windows 7) What I did was: Download the ZIP file, Extract libmysql.dll, Place it in the folder C: \ Program Files (x86) \ Embarcadero \ RadPHP \ 4.0 \ bin. I got the message: "Can not load libmysql.dll library (error code 6). Libmysql.dll library May be missing from the system path or You May Have An incompatible version of the library installed" Any advice is welcome. Enrique

@Enrique You will need to make sure the the DLL is in your win7 Path. I haven't tried in RadPHP XE2 but for Rad Studio XE & XE2 I have it in C:\Users\Public\Documents\RAD Studio\9.0\BPL. You can check what paths are being used on your system by typing "path" in a command prompt and putting the DLL in the appropriate place.

Thank you so much Brett, I'll try soon. Best regards.

Well done! Solved my problem also (Win7x64 and Delphi XE2). Thanks

Dear Brett. I searched and "destroyed" all versions of libmysql.dll resident on my PC. The route used by RadPHP XE2, is the previously indicated (C: \ Program Files (x86) \ Embarcadero \ RadPHP \ 4.0 \ bin). Anyway, I put libmysql.dll (version 5.1.59) in the Windows path and in % SystemRoot% \ System32. I changed the environment variable "Path" to reflect the changes, but the error persists. Interestingly, when testing the connection works fine, but the error (DBX: Not supported) persists when try to show tables, procedures, etc. For now, I give up. I had never taken so long to set up a connection. Best regards.

Excellent, you save me!

Thanks man. It work's. (Win2008x64 and Delphi XE).

THAAAAAAAAAAAAAAAAAAAAAAANKS! LOL It seems to be working! ;D Well done man. (WIN7x32 - Delphi XE2 - MYSQL 5.5)

thx a lot,will test it later

Thank you very much. Great - You saved me lots of time. (Win7x64 and Delphi XE2)

I am having exact same problem as Enrique above, (DBX: Not supported). I can connect to a local instance of mySQL and browse tables with database manager, but for the remote instance it says "test succeeded" but when I try to browse tables it gives the above error. libmysql.dll is exact same version on my web server. DBX I am assuming is dbexpress. Does anyone know if there are additional files required on the webserver to work with a remote mysql connection? Win7 64 OS on desktop, all mysql 5.1.56 32bit on desktop and webserver. Any suggestions appreciated, ready to pull my hair out here, thanks.

Thanks a lot! I do hope this is added to the somewhat lacking documentation of embracedero XE2

Thanks! You can't imagine how many times I try to get this connection work...

Thank you very much!!!!! This solution actually works!

THAAAAANKS!!! people. Special thanks to Brett Wilton. You saved my life. :)

Hello Brett, I also have the same problems as Enrique and pj. I run Win7 Home Premium 2009, 64bits, Embarcadero® RadPHP™ XE2 Version, MySQL 5.5 (but also the remote MySQL of my hosting provider generates the same problem): DBX: Not supported. I can connect to a local and remote instance of mySQL and browse tables with database manager, but when I try to browse tables in RADPhP (expand tables branche of MySQLConnection) I get the error. Because Enrique and pj seized their quest, I wonder if I must do the same or if there are possibilities to get rid of this error. Looking forward to your view on this!

where online i can get dbxmys? thk

thank you !!!

Thank you very much!

I spent hours trying to work this out. With the dll you supplied it now works. Thanks so much.

thanx a lot you saved us

Thank you for this solution!

dear!I also have the same problems to connect sql server2000,how to do?

Thanks man. It work's. (Windows 7 x64 and Delphi XE). Extract libmysql.dll, Place it in the folder "C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\bin64"

TY!!! It´s working now!

I have a problem. This don´t work. If i try to run mey application the some problem exists. What i do?


It works (for me). If don't - just restart your IDE.

I searched many sites. This DLL is the solution!

Valeu, muito obrigado

Sigue sin funcionar :(

Ahora si, copie el archivo a C:\Program Files (x86)\Embarcadero\RAD Studio\x.x\bin. Tanks!!!

Works like a charm! Million Thanks!

Wow.. it's works well done, I try to download then i copy that to my system32 folder, and i try to connect to mysql database but still the same problem, after that i try to close my XE2 and open it the application and try to connect again, then viola.. i success to connect that.. thanks manyyyyyy thanks..

hey.. i want to explain that the libmysql.dll should be put into C:\Program Files (x86)\Embarcadero\RAD Studio\x.x\bin i also put into the system32, but i think should work just put into like above, because there another libmysql.dll version i use for rails application in system32 too ..

thanks a ton brother!

Thank You Works on Windows 8 x64 with Delphi XE2 update 4 =)

one million thankssssssssss brot

I can't work with the input and output parameters when related components of Delphi StoredProcedure XE2 to functions or stored procedures in my mysql database, please i am paying for that maybe somebody can explain and solve this problem, if you prefer can remotely connect to my PC, my email is [email protected]

Thank you!

Many thanks


Hey man, thank you very much Only here I managed to solve this problem very good, congratulations

Thank you - I spent so much time on this before finding your post. Your solution works perfectly! :¬)

thanks m8. i was defeated.

I was stuck with this gruesome problem for a whole day and also tried several "libmysql"s but no luck, then suddenly your file works just fine. thank you very much for this very helpful post.

wow, it worked with me , can't believe that ; I downloaded the zip and I extracted it to the directory: C:\Program Files\Embarcadero\RAD Studio\9.0\bin since I am using a windows 7 /32 bits. Thank you very mmuch for the solution ;)

Sorry, comments have been closed for this post.
(default) 11 queries took 5 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `posts`17171
2DESCRIBE `comments`11111
3DESCRIBE `tags`221
4DESCRIBE `categories`220
5DESCRIBE `posts_tags`220
6DESCRIBE `categories_posts`220
7SELECT `Post`.`id`, `Post`.`url`, `Post`.`title`, `Post`.`icon`, `Post`.`metadesc`, `Post`.`metakeys`, `Post`.`categories`, `Post`.`tease`, `Post`.`body`, `Post`.`private_body`, `Post`.`created`, `Post`.`modified`, `Post`.`status`, `Post`.`allow_comments`, `Post`.`tags`, `Post`.`hitcount`, `Post`.`hitcount_rss` FROM `posts` AS `Post` WHERE `Post`.`url` = 'getting-embarcadero-dbexpress-mysql-working-dbx-error-driver-not-initialized' LIMIT 1111
8SELECT `Comment`.`id`, `Comment`.`post_id`, `Comment`.`body`, `Comment`.`author`, `Comment`.`url`, `Comment`.`email`, `Comment`.`ip`, `Comment`.`status`, `Comment`.`junk_score`, `Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment` WHERE `Comment`.`status` = 2 AND `Comment`.`post_id` = (84) 50501
9SELECT `Tag`.`id`, `Tag`.`tag`, `PostsTag`.`post_id`, `PostsTag`.`tag_id` FROM `tags` AS `Tag` JOIN `posts_tags` AS `PostsTag` ON (`PostsTag`.`post_id` = 84 AND `PostsTag`.`tag_id` = `Tag`.`id`) 880
10SELECT `Category`.`id`, `Category`.`category`, `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id` FROM `categories` AS `Category` JOIN `categories_posts` AS `CategoriesPost` ON (`CategoriesPost`.`post_id` = 84 AND `CategoriesPost`.`category_id` = `Category`.`id`) 110
11UPDATE `posts` AS `Post` SET `Post`.`hitcount` = Post.hitcount + 1 WHERE `Post`.`id` = 8410