Lazarus: MySQL error “libmysql.dll” missing

Access to MySQL databases with Lazarus.

Today I played around a bit with Lazarus and wanted to access a MySQL database. A bit like before, just drag the components onto the form, configure and done? Unfortunately not quite. At runtime there was an error message:

Can not load default MySQL library ("libmsysql.dll" or "libmysql.dll"). Check your installation.

So here you still need a special DLL to access the database. But where do you get the DLL? The download is available here.

The file can be found in the ZIP archive.

It is important to download the appropriate version. Then add the DLL to the programme directory. In my case, the 5.7 version was the right one for now. Unfortunately, I still had problems with the new 8 version. I’ll have to test it when I get the chance.

Linux

As one would expect, there were also problems in Linux. The error message is similar here.

Can not load default MySQL library ("libmysqlclient.so.20" or "libmysqlclient.so").

So the same problem. So just copy the appropriate files? Unfortunately, that didn’t really work. First of all, we download the appropriate Linux version.

Unlike Windows, Linux does not search for the library in the programme directory. This only brings us the same error message again.

Instead, we copy the files (symlinks and library) into the /usr/lib directory. Afterwards, the application started without any problems.

Leave a Reply

Your email address will not be published. Required fields are marked *