Linking Mysql 8 with Delphi 12 64bit

I have Delphi 12 and MySQL 8 both in 64 bit. I have been trying to get the connection working. Through research I have come to believe my problem is with the libmysql.dll version. I have checked it with sigcheck to make sure it is 64 bit and in FDPhysMySQLDriverLink1 I have set VendorLib to a path so I know I am using the selected libmysql.dll

Since changing from a version 9 dll to a version 8 dll I have got some results (ID and surname) from a mysql table (using select 1 from test_value;). However I can not set the connection to true in FDConnection1 without getting a 314 error complaining about using the right dll and ensuring is x86.

CHATGPT is now suggesting I use a dll 5.7 which is not available on the mysql archive site.

Can anyone advise on how to link Delphi 12 to a mysql 8 database both in 64 bit.

The trouble you are having is likely because you are compiling a 64-bit app and have the 64-bit version of libmysql.dll, but the IDE is 32-bit. You need to get hold of the 32-bit version of libmysql.dll as well. The trouble is locating the 32-bit dll from memory though, from the mysql website.

You then set this 32-bit dll in the design time properties of FDPhysMySQLDriverLink1.Vendorlib and then at runtime, set it to the location of the 64-bit dll. This will allow you to get both ide working and your app working.

I use MySQL8 64 bit with Delphi 10. However I understood from the beginning the best way was to use FireDAC ODBC connection with 32 bit ODBC MySQL driver.

You can use Libmaria.dll (from MariaDB) - they have some 32bit DLLs around.

It will work with MySQL and allow you to have ‘live’ connections in the 32bit IDE. If you are using version 13 you can use the 64bit IDE and the regular MySQL driver.

Also you might want to consider 3rd party libraries like Devart’s AnyDAC which does away with the need for a DLL and supports a direct connection, in either 32 or 64bit apps.

2 Likes

This is not correct. The library is much faster (in my experience).

I had exactly the same problem as the original poster. So when I say best way, it would be better to say, the only way I could connect from Delphi to 64bit MySQL

The Delphi IDE - or Delphi apps?

Because that’s two different things. I used to work on 32bit and 64bit Delphi apps which definitely connected to 64bit versions of MySQL.

For the IDE the only way to do it is in the 64bit IDE or put the 32bit MariaDB dll in the appropriate place so the IDE can pick it up.

I work in the IDE so, when I code I ensure I can connect to the database. So for me the IDE working is a non negotiable. I don’t use the term ‘apps’. I write Delphi VCL applications.

Hi Robert, I have both 32 and 64 bit dlls, compatible with v8 of mysql.

I am not sure if they work with the ide. I can try.

Hi

Thanks for the pointers. IN the end I used a LibMariaDb.dll (32bit) which allowed me to set the FDCOnnection to true , then save it and then pointed the VendorLib back to the 64bit LibMYSQl.dll and it works.

3 Likes

:joy:

Ok then! I shall go and sit on The Naughty Step and have a good think about my vocabulary.