Lazarus and Mysql on remote computer does not work lazarus / 16-Databases ---------------------------------------------------------------------- alander · 2021-03-23 15:56 Hi, please I am using Lazarus the last version with mysql 8.0. The local connection everything goes well, but on remote machine, my app cannot connect to database on server. Could you help me please ? I am using windows 10 64bits I have opened the port 3306 in Server computer firewall but it does not work. In mysql I have created a user with all privilegies for local and all network connection. I have tried with root user as well, but I cannot. this is my .ini file from my application In my application folder, I use my app file, .ini., libmysql.dll, zlib1.dll and nothing else IP=Server Database=soft Port=3306 Library=C:\soft\libmysql.dll User=soft Pass=********* When I tried to open my app on remote computer the message error is: Client-Library c:\myapp\libmysql.dll found but could not be loaded. Check compile-target and library compatibility!. What do I have to do ? I am new with lazarus, I came from Delphi. Regards ---------------------------------------------------------------------- BSaidus · 2021-03-23 17:24 May be you miss to create a user like this on myssql:      user@% and give this user the rights on the desired database ---------------------------------------------------------------------- af0815 · 2021-03-23 21:35 Quote from: alander on March 23, 2021, 04:56:39 pmClient-Library c:\myapp\libmysql.dll found but could not be loaded. Check compile- target and library compatibility!.In Lazarus you are able to compile for 32Bit or 64Bit. So depending on this you have to use the correct dll's for the bitness. A 32bit programm can not use a 64Bit library and 64Bit programm can not work with a 32 bit dll. with pesp https://github.com/stievie/pesp you can check the bitness - the programm must be compiled with lazarus/fpc. ---------------------------------------------------------------------- Gustavo 'Gus' Carreno · 2021-03-23 22:33 Hi Alander, Let's give you a checklist for you to go through and see what's what: Can you connect to the remote server by using a tool like HeidiSQL or the MySQL Workbench This will make sure that firewall rules are good and you created the correct user format.Like @BSaidus mentioned, is your user created like: user@% or user@localhost? For remote usage you need the user@% versionMake sure that you have/include the correct *.dll files for the architecture of your binary. That means if you compile your app as 64b, it will only dynamically load 64b *.dll, never 32b *.dll. If you compile your app as 32b, it will only dynamically load 32b *.dll, never 64b *.dll.The *.dll have to be, either on the same folder of the binary or in the path of the system.The BindAddress-Parameter in my.ini/my.cnf <-- As suggested by @Zvoni Out-of-the Box MySQL listens only to localhostI'm sure I'm missing some other steps, I'll ask the community to pad my holes, thanks! When I say binary I mean the app's *.exe file. Sorry, more used to Linux lingo. Cheers, Gus ---------------------------------------------------------------------- Zvoni · 2021-03-24 07:04 Gus, you forgot one stumbling stone of MySQL: The BindAddress-Parameter in my.ini/my.cnf Out-of-the Box MySQL listens only to localhost ---------------------------------------------------------------------- Gustavo 'Gus' Carreno · 2021-03-25 01:48 Hi Zvoni, Quote from: Zvoni on March 24, 2021, 08:04:52 amGus, you forgot one stumbling stone of MySQL: The BindAddress-Parameter in my.ini/my.cnf Out-of-the Box MySQL listens only to localhost ARGH, I knew I forgot something. Erroneously, I think I assumed that if he fiddled with the Firewall he fiddle with my.cnf. Sorry, my bad, will edit my post!! Many thanks for the save Zvoni!! Cheers, Gus ---------------------------------------------------------------------- alander · 2021-03-30 10:28 Quote from: alander on March 23, 2021, 04:56:39 pmHi, please I am using Lazarus the last version with mysql 8.0. The local connection everything goes well, but on remote machine, my app cannot connect to database on server. Could you help me please ? I am using windows 10 64bits I have opened the port 3306 in Server computer firewall but it does not work. In mysql I have created a user with all privilegies for local and all network connection. I have tried with root user as well, but I cannot. this is my .ini file from my application In my application folder, I use my app file, .ini., libmysql.dll, zlib1.dll and nothing else IP=Server Database=soft Port=3306 Library=C:\soft\libmysql.dll User=soft Pass=*********Quote from: af0815 on March 23, 2021, 10:35:57 pmQuote from: alander on March 23, 2021, 04:56:39 pmClient-Library c:\myapp\libmysql.dll found but could not be loaded. Check compile- target and library compatibility!.In Lazarus you are able to compile for 32Bit or 64Bit. So depending on this you have to use the correct dll's for the bitness. A 32bit programm can not use a 64Bit library and 64Bit programm can not work with a 32 bit dll. with pesp https://github.com/stievie/pesp you can check the bitness - the programm must be compiled with lazarus/fpc. Quote from: af0815 on March 23, 2021, 10:35:57 pmQuote from: alander on March 23, 2021, 04:56:39 pmClient-Library c:\myapp\libmysql.dll found but could not be loaded. Check compile-target and library compatibility!.In Lazarus you are able to compile for 32Bit or 64Bit. So depending on this you have to use the correct dll's for the bitness. A 32bit programm can not use a 64Bit library and 64Bit programm can not work with a 32 bit dll. with pesp https://github.com/stievie/pesp you can check the bitness - the programm must be compiled with lazarus/fpc. When I tried to open my app on remote computer the message error is: Client-Library c:\myapp\libmysql.dll found but could not be loaded. Check compile-target and library compatibility!. What do I have to do ? I am new with lazarus, I came from Delphi. Regards Hi, thanks for your contact. I am using now 64 bits from my aplication and mysql dll. but When I try to connect from a remote pc, I recive a message error Access denied for user ..... I have created a new user with all permisses in mysql in graphics mode, but I do not know what is the problem. ---------------------------------------------------------------------- dseligo · 2021-03-30 10:44 You must specify in MySQL where from the user is allowed to connect. I attached screenshot which shows how this is done in HeidiSQL. I marked setting which allow you to connect from anywhere. ---------------------------------------------------------------------- alander · 2021-03-31 10:19 Quote from: dseligo on March 30, 2021, 12:44:16 pmYou must specify in MySQL where from the user is allowed to connect. I attached screenshot which shows how this is done in HeidiSQL. I marked setting which allow you to connect from anywhere. Hi dseligo, in my WorkBench I have put inside host % for all hosts and it does not work. is there any mysql file to setup ? thanks ---------------------------------------------------------------------- Zvoni · 2021-03-31 11:45 What about BindAddress in my.cnf/my.ini? ---------------------------------------------------------------------- dseligo · 2021-03-31 22:01 Quote from: alander on March 30, 2021, 12:28:25 pmI recive a message error Access denied for user ..... Can you give exact error message, word by word? If you get this message, I'd say you are communicating with mySQL server. Are you sure you are using correct password? ---------------------------------------------------------------------- dseligo · 2021-03-31 22:09 And try SHOW GRANTS; on your database server (you can paste it here, blank password if it shows). Did you restart mysql server after change?