MySql, problem after a problem, Server connect failed lazarus / 16-Databases ---------------------------------------------------------------------- Orvel · 2013-12-04 12:34 I have a local Fedora server. On it running MySql 5.1.69. I need to develop for Linux so I chose FPC/Lazarus. First I got the libmysql.dll error, which I fixed by copying the dll into Lazarus folder. Now I got a "MySQL51Connection1: Server connect failed.". What the hell ? I always enjoyed developing in Delphi, this is similar and would like to solve this. I don't  want to give up on Lazarus/fpc. Edit: I'm developing on Windows 7, in the end, I will just compile on CentOS. ---------------------------------------------------------------------- marcov · 2013-12-04 12:58 A connection if enabled=true goes live on start. That means IP + port have to be filled in. (this is no different from Delphi so I assume you know that). And of course firewalls can be a problem too, both on the client and the servers firewall. ---------------------------------------------------------------------- jack616 · 2013-12-04 13:08 2 things that trip us up when doing this: 1. Ensure you use the right version number in lazarus for your server 2. Ensure you use 64 bit mysql when developing 64bit and 32 bit mysql.dll when developing 32 bit even on win64. ---------------------------------------------------------------------- Orvel · 2013-12-04 13:43 Thank you for your reply. I filled in all the necessary information. Firewall on both the PC and the server is not the problem. A C# application logs on MySql without problem. I use TMySQL51Connection, I get this error. When I use other versions, I get "...can not work with the installed MySQL client version expected ...". Edit: I have 32 bit OS ---------------------------------------------------------------------- marcov · 2013-12-04 13:57 And libmysql.dll is 5.1 ? ---------------------------------------------------------------------- Orvel · 2013-12-04 14:01 I downloaded the official noinstall version and extracted the dll into Lazarus and project folder. Lazarus installed from binary downloaded from sourceforge. ---------------------------------------------------------------------- Orvel · 2013-12-04 14:24 I am going to try it at home, with localhost and newer MySql version. ---------------------------------------------------------------------- Orvel · 2013-12-04 19:58 I got the same error at home. Tried to fix it, but gave up. I installed Zeos and it connects with it without problems. It is unstable though. I populated dropdown box with data, after that I tried to populate listbox and Lazarus was not responding when I set query active to true, then it crashed, and a few times after that. *sigh* I hope this wont happen at runtime. Thank you anyway. ---------------------------------------------------------------------- BigChimp · 2013-12-05 07:10 My crystal ball says your sqldb mysql problems could have been caused by 0. Not reading instructions. 1. Did you hit the error design time or run time? As the docs say (see wiki) you need to make sure the dlls are in your application executable (or windows/system32 or in your PATH) directory. If that happens to not be your project directory.. which is the default... well. 2. you may need more .dlls, not only libmysql.dll but also some encryption stuff. ---------------------------------------------------------------------- Orvel · 2013-12-05 07:52 I get the error both design time and run time. I copied the libmysql.dll to project directory and Lazarus folder. I don't know anything about any additional .dlls. I've googled, but haven't been able to find anything. ---------------------------------------------------------------------- marcov · 2013-12-05 09:34 Quote from: Orvel on December 05, 2013, 08:52:28 amI get the error both design time and run time. I copied the libmysql.dll to project directory and Lazarus folder. I don't know anything about any additional .dlls. I've googled, but haven't been able to find anything. Sometimes db clientlibs depend on other dlls,  usually for SSL.   I don't know how this works with mysql though, since I'm a postgresql user. ---------------------------------------------------------------------- BigChimp · 2013-12-05 09:52 Does your .exe end up in your project directory? If not, please copy the dll(s) into that directory. Instructions on where to put the dlls: e.g. http://wiki.lazarus.freepascal.org/mysql#Simple_MySQL_Demo_Using_the_T MySQL5xConnection_Component ---------------------------------------------------------------------- BigChimp · 2013-12-05 09:53 Quote from: marcov on December 05, 2013, 10:34:38 amSometimes db clientlibs depend on other dlls,  usually for SSL.   I don't know how this works with mysql though, since I'm a postgresql user. Yes. I remember having to copy over libssleay32.dll and/or some other SSL dlls. Don't know if this is required for mysql 5.1. ---------------------------------------------------------------------- BigChimp · 2013-12-05 09:54 Quote from: Orvel on December 04, 2013, 03:24:54 pmI am going to try it at home, with localhost and newer MySql version. BTW: I assume you're still using a client dll that matches the number in TMySQLxxConnection... Crystal ball is running on empty ---------------------------------------------------------------------- Orvel · 2013-12-05 10:41 Quote from: BigChimp on December 05, 2013, 10:52:22 amDoes your .exe end up in your project directory? If not, please copy the dll(s) into that directory. Instructions on where to put the dlls: e.g. http://wiki.lazarus.freepascal.org/mysql#Simple_MySQL_Demo_Using_the_T MySQL5xConnection_Component Yes, it ends up in the project directory, and the dll is there. Quote from: BigChimp on December 05, 2013, 10:54:13 amQuote from: Orvel on December 04, 2013, 03:24:54 pmI am going to try it at home, with localhost and newer MySql version. BTW: I assume you're still using a client dll that matches the number in TMySQLxxConnection... Crystal ball is running on empty I downloaded the "mysql-noinstall-5.1.72-win32.zip", from which I extracted the dll. I used TMySQL51Connection component. Tried the .dll from mysql 5.0, it resulted in a different error.... the "...wrong version..." error. Also I used the 5.1.72 dll in ZeosDB component and it works there. Thank you for the replies. ---------------------------------------------------------------------- BigChimp · 2013-12-05 10:50 Ok that different error message sounds convincing as far as troubleshooting is concerned. Then you probably installed everything correctly.. but entered the wrong details (hostname, database, username, password) somehow? I don't use mysql myself (just test on it occasionally), so can't help you there. As Zeos works, it wouldn't be a firewall/permissions whatever error as that can connect... Still quite irritating that something that should just work... doesn't. ---------------------------------------------------------------------- mangakissa · 2013-12-05 11:01 Maybe a small example with dll? I've got MySQL running on Lazarus without problems. ---------------------------------------------------------------------- Orvel · 2013-12-05 12:03 I re-installed the whole thing. Created a new database and new user with privileges. It works now . It works with the old settings too . I don't know what was wrong. Thank you for the help.