Recent

Author Topic: Connection MySQL database  (Read 15258 times)

Kalevi

  • New Member
  • *
  • Posts: 29
Connection MySQL database
« on: November 01, 2017, 11:42:34 am »
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

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Connection MySQL database
« Reply #1 on: November 01, 2017, 11:52:03 am »
keep it simple

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Connection MySQL database
« Reply #2 on: November 02, 2017, 01:57:01 pm »
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

  • New Member
  • *
  • Posts: 29
Re: Connection MySQL database
« Reply #3 on: November 02, 2017, 03:12:25 pm »
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

  • Hero Member
  • *****
  • Posts: 6162
Re: Connection MySQL database
« Reply #4 on: November 02, 2017, 03:26:57 pm »
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

  • New Member
  • *
  • Posts: 29
Re: Connection MySQL database
« Reply #5 on: November 02, 2017, 05:45:51 pm »
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

  • Hero Member
  • *****
  • Posts: 6162
Re: Connection MySQL database
« Reply #6 on: November 02, 2017, 07:43:27 pm »
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

  • New Member
  • *
  • Posts: 29
Re: Connection MySQL database
« Reply #7 on: November 02, 2017, 09:48:22 pm »
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

  • Hero Member
  • *****
  • Posts: 6162
Re: Connection MySQL database
« Reply #8 on: November 02, 2017, 10:06:49 pm »
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.
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.

« Last Edit: November 02, 2017, 10:08:25 pm by rvk »

Kalevi

  • New Member
  • *
  • Posts: 29
Re: Connection MySQL database
« Reply #9 on: November 03, 2017, 09:30:44 am »
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

  • Hero Member
  • *****
  • Posts: 6162
Re: Connection MySQL database
« Reply #10 on: November 03, 2017, 09:59:04 am »
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

  • New Member
  • *
  • Posts: 29
Re: Connection MySQL database
« Reply #11 on: November 03, 2017, 10:12:22 am »
My Lazarus is version 1.6.4 64-bit

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: Connection MySQL database
« Reply #12 on: November 03, 2017, 10:20:52 am »
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

  • New Member
  • *
  • Posts: 29
Re: Connection MySQL database
« Reply #13 on: November 03, 2017, 11:03:19 am »
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

  • Hero Member
  • *****
  • Posts: 6162
Re: Connection MySQL database
« Reply #14 on: November 03, 2017, 11:08:38 am »
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.
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.

 

TinyPortal © 2005-2018