Connection MySQL database lazarus / 16-Databases ---------------------------------------------------------------------- Kalevi · 2017-11-01 10:42 I was trying to connect to the MySql database with Lazarus but did not get any connection. I use the TMySQL56Connection Compoment and the MySql Server 5.7. I have already copied the libmysql.dll the windows system32, SysWOW64 and my project directory. I get the error message TMySQL56Connection can not work with the installed client version expected (5.6) got (5.7.17). I hope that you can help me. Thanks for the help. Kalevi ---------------------------------------------------------------------- munair · 2017-11-01 10:52 Maybe this thread can help: https://forum.lazarus.freepascal.org/index.php?topic=34795.0 ---------------------------------------------------------------------- LacaK · 2017-11-02 12:57 You can use TMySQL57Connection component or set SkipLibraryVersionCheck property to True. I think if you use at least FPC version 3.0.x ... in older versions these are not available IIRC ---------------------------------------------------------------------- Kalevi · 2017-11-02 14:12 Mysql in Lararus only has a 5.6 Connection.  So I would need a  5.7 connection in my Lazarus. The problem is that I do not know where to down-load that component. ---------------------------------------------------------------------- rvk · 2017-11-02 14:26 What LacaK was saying that you can check the SkipLibraryVersionCheck in your TMySQL56Connection. This is available in Lazarus 1.6.4 (FPC 3.0.2). (see image) ---------------------------------------------------------------------- Kalevi · 2017-11-02 16:45 I tried to check the SkipLibraryVersionCheck in my TMySQL56Connection. But still the error sign appeared. Please see the attached image. I have in Lazarus 1.6.4 ---------------------------------------------------------------------- rvk · 2017-11-02 18:43 That's a different message than you got before, isn't it? The libmysql.dll you have in your program directory (and Lazarus directory if you connect in the ide) is that a 32 bit version or a 64 bit version? You say you copied libmysql.dll to syswow64 and system32. If you copied the same version to both directory that is definitely wrong. ---------------------------------------------------------------------- Kalevi · 2017-11-02 20:48 Yes, the error message is different if the SkipLibraryVersio is selected as true, then the message is "MySQL56Connection1 : Server connect failed", and in the case of if false, the message is " MySQL56Connection1 can not work with the installed MySQL client version Expected (5.6) got (5.7.17)". I have downloaded "Windows (x86,32 & 64-bit), MySQL Installer MSI" at the following adress, https://dev.mysql.com/downloads/mysql/ both 32-bit and 64-bit zip that I have then unzipped, and after that copied libmysql.dll to both the Lazarus directory and the Windows System32 32-bit version, or the Lazarus directory and Windows SysWOW64 64-bit version. I have used Windows 10. ---------------------------------------------------------------------- rvk · 2017-11-02 21:06 Quote from: Kalevi on November 02, 2017, 09:48:22 pmI have downloaded "Windows (x86,32 & 64-bit), MySQL Installer MSI" at the following adress, https://dev.mysql.com/downloads/mysql/ both 32-bit and 64-bit zip that I have then unzipped, and after that copied libmysql.dll to both the Lazarus directory and the Windows System32 32-bit version, or the Lazarus directory and Windows SysWOW64 64-bit version. I have used Windows 10. Well, that's wrong. You probably installed the 64 bit Lazarus 1.6.4 (which is the default download for 64 bit Windows). In that case you need to copy the 64 bit version of libmysql.dll to the Lazarus directory and your .exe directory if you're running your exe standalone (not in ide). Remove the libmysql.dll from the system32 and SysWOW64 because you copied the wrong versions there. You don't need them there anyway if you have them in Lazarus and your exe directory. But for future reference... the system32 is for 64 bit DLLs and the SysWOW64 is for 32 bit DLLs. I know that's confusing but that's the way it is. But if you have them in your exe and Lazarus directory don't bother with Sysem32 and SysWOW64. ---------------------------------------------------------------------- Kalevi · 2017-11-03 08:30 Thank you for your many advices but still I cannot get the connection to MySQL. I first deleted all libmysql.dll and after that I copied the 64-bit version libmysql.dll  Windows System32 directory and the Lazarus directory. I am a new Lazarus user and I have done all my earlier projects using the Delphi. Should I give up all do you still have some piece of advice for me? Thank you so much for your cooperation, ---------------------------------------------------------------------- rvk · 2017-11-03 08:59 And do you have the 64 bit Lazarus or the 32 bit Lazarus ? Check under Helpt > About Lazarus Right click the version information and choose Copy version information to clipboard and paste it here. ---------------------------------------------------------------------- Kalevi · 2017-11-03 09:12 My Lazarus is version 1.6.4 64-bit ---------------------------------------------------------------------- rvk · 2017-11-03 09:20 Can you connect to your database with a different SQL manager (like dbeaver or MySQL Workbench). I also see you have spaces in your database-filename path. Try to put the database somewhere else. Like "C:\test\data.db". ---------------------------------------------------------------------- Kalevi · 2017-11-03 10:03 I have installedLazarus in another computer but again with the sama resut. There this does not work - no connection. I also tried the MySQL test database sakila-data, but again, no connection. In both of my computers the Firebird-database connection works very well. ---------------------------------------------------------------------- rvk · 2017-11-03 10:08 Quote from: Kalevi on November 03, 2017, 11:03:19 amI have installedLazarus in another computer but again with the sama resut. There this does not work - no connection. I also tried the MySQL test database sakila-data, but again, no connection. In both of my computers the Firebird-database connection works very well. How did you install the MySQL server? (you did install the server, right?) I even think if you installed the MySql Server 5.7 then you shouldn't need to mess with dll because the client is installed with it locally. ---------------------------------------------------------------------- Kalevi · 2017-11-03 11:07 My  MySQL-server  is 5.7 ---------------------------------------------------------------------- rvk · 2017-11-03 11:13 And can you connect from the mysql console to your database? (I also already gave you the suggestion to move the database to a shorter simpler path) ---------------------------------------------------------------------- Kalevi · 2017-11-03 11:20 Its working very well ---------------------------------------------------------------------- rvk · 2017-11-03 11:24 Then I don't know why you can't connect from Lazarus. ---------------------------------------------------------------------- balazsszekely · 2017-11-03 15:24 Please do the following: 1. Disable every AV, firewall even the built in defender 2. Download libmysql5.7(64 bit) from here: https://drive.google.com/open?id=0B9Me_c5onmWoQmJ2RUtqYVFaMlU 3. Extract the content of the zip to the Lazarus main folder and your project folder, forget about windows system folders 4. Make sure the mysql server is running 5. Database name instead of "c:\lazarus\Omat..." should be "uusipenni" 6. Double check username and password I just tested the above method with a local mysql database and it works fine, so it's nothing wrong with the lazarus component. ---------------------------------------------------------------------- rvk · 2017-11-03 15:31 Quote from: GetMem on November 03, 2017, 04:24:41 pm5. Database name instead of "c:\lazarus\Omat..." should be "uusipenni" Yikes. Yes, that's probably the cause  In Firebird you need to specify the path and database filename. For MySQL you just need to supply the databasename. ---------------------------------------------------------------------- Kalevi · 2017-11-03 18:30 I first deleted the entire Lazarus program and after that installed it once again. I also delete all the Lazarus projects, and finally I created a new project (please see the attachment). I also tested if I change the database name even one char so I again receive  the same error message. I also tested with several databases that work with Workbench, and again with the same outcome. ---------------------------------------------------------------------- rvk · 2017-11-03 18:34 You forgot to check the checkbox for skipversioncheck. (And do you really have a databasename with .sql after it? Never seen that) ---------------------------------------------------------------------- Kalevi · 2017-11-03 19:02 I tested as you suggested. ---------------------------------------------------------------------- rvk · 2017-11-03 19:08 I'm not that familiar with the TMySQL56Connection but is port 0 correct? Does it take the default mysql port in that case? Otherwise set it to 3306. ---------------------------------------------------------------------- balazsszekely · 2017-11-04 07:04 It's pretty obvious that something is between you(lazarus) and the server. I can easily simulate your error message, just by changing the host name(https://youtu.be/FHCObKukq8o). Again disable firewall. Port number also can be an issue as @rvk mentioned. If you made a default installation(3306) you can leave it to 0 in lazarus, otherwise change it to whatever port is in your ini file, see attachment. ---------------------------------------------------------------------- Deepaak · 2017-11-04 07:22 What's ur database path and Name of ur Server. ---------------------------------------------------------------------- Kalevi · 2017-11-04 09:54 Now it works! Excellent! I changed the port 3306 and created a new schema for MySQL. Additionally, I made the following changes: 1. I copied libmysql.dll version 3.11.2017 5173kt only to the Lazarus directory (not Windows/system32). 2. I added a checkbox for skipversioncheck. 3. I wrote the databasename without ".sql"