Author Topic: Incorrect MySQL client version  (Read 1832 times)

jollytall

  • Sr. Member
  • ****
  • Posts: 380
Incorrect MySQL client version
« on: April 08, 2023, 12:36:47 pm »
I have few programs that use MySQL, though I did not use them for some time. Now I tried again, and they all fail with error:
Code: Text  [Select][+][-]
  1. TMySQL57Connection can not work with the installed MySQL client version: Expected (5.7), got (3.1.20).
Indeed all my settings are for 5.7:
Code: Pascal  [Select][+][-]
  1. uses
  2.   lazutf8,
  3.   mysql57conn, mysql57dyn, sqldb;
  4. var
  5.   MainSQLConnection_ : tMYSQL57Connection;
but as far as I know, my MySQL is also 5.7:
Code: Text  [Select][+][-]
  1. ~$ mysql
  2. Welcome to the MySQL monitor.  Commands end with ; or \g.
  3. Your MySQL connection id is 4
  4. Server version: 5.7.29 MySQL Community Server (GPL)
What do I do wrong? What could change since the last use?

Thanx

balazsszekely

  • Guest
Re: Incorrect MySQL client version
« Reply #1 on: April 08, 2023, 12:54:43 pm »
@jollytall
If you're absolutely sure that MySQL version is 5(I'm not) , then Set SkipLibraryVersionCheck property to True and see what happens.

jollytall

  • Sr. Member
  • ****
  • Posts: 380
Re: Incorrect MySQL client version
« Reply #2 on: April 08, 2023, 01:54:02 pm »
Thanks,
I am almost sure, as this one worked for some time and also if you see my OP, it gives the version as 5.7.29, however the error message was about the MySQL Client, not the server.
I tried your idea, and it went through the Connect := true; step, but it gave me an error with the Query ExecSql:
EDatabaseError, Database not assigned.
So, something is clearly wrong.

balazsszekely

  • Guest
Re: Incorrect MySQL client version
« Reply #3 on: April 08, 2023, 02:00:55 pm »
Thanks,
I am almost sure, as this one worked for some time and also if you see my OP, it gives the version as 5.7.29, however the error message was about the MySQL Client, not the server.
I tried your idea, and it went through the Connect := true; step, but it gave me an error with the Query ExecSql:
EDatabaseError, Database not assigned.
So, something is clearly wrong.
Maybe you have multiple version of MySQL installed?

jollytall

  • Sr. Member
  • ****
  • Posts: 380
Re: Incorrect MySQL client version
« Reply #4 on: April 08, 2023, 02:56:42 pm »
I don't know. Attaches is the complete list of installed packages with "sql" in their name/description. I manually removed everything I could, but nothing helped.
Where else could I look for it?

jollytall

  • Sr. Member
  • ****
  • Posts: 380
Re: Incorrect MySQL client version
« Reply #5 on: April 08, 2023, 03:20:05 pm »
I found one thing:
https://mariadb.com/kb/en/mariadb-connector-c-3-1-20-release-notes/

It says:
Quote
Notable changes

mysql_get_client_info()/mysql_get_client_version() now return the Connector/C specific version (instead of corresponding server version),
so I guess this is why FPC/Lazarus sees 3.1.20 (connector version), instead of 5.7 (what is the server version).

I am not sure, if this is also the reason why after switching off the version check it still does not work. Keep on trying. I will need to check if there is a FPC upgrade to handle this.

EDIT: I checked it, and the MariaDB version is from the 7/Feb/2023, while on gitlab I do not see any update on mysql57conn in the last 2 years, so probably there is no new sw. I am still wondering why switching off the version check it still fails.
« Last Edit: April 08, 2023, 03:57:46 pm by jollytall »

jollytall

  • Sr. Member
  • ****
  • Posts: 380
Re: Incorrect MySQL client version
« Reply #6 on: April 08, 2023, 05:27:00 pm »
Sort of solved.

The core of the problem was, as I noticed above, that MariaDB now gives back the client version, not the server version, so the Connect fails. Using SkipLibraryVersionCheck bypasses this problem. It would be good to fix it though.

Then it still did not work, but that is an old problem, that a variable in the testing program was named SQLConnection and this is also the name of a property in tSQLTransaction so in a with statement it picked up the property not the variable. This I had once in the past, this is why I start the variables sometimes with My..., but now I forgot it in the test program and thought that it is still related to the original MariaDB problem. So, thanks for looking into it, but this part was my fault.

And a third thing. I saw on gitlab that now there is support for 8.0 as well. I copied the mysql80conn and mysql80dyn files and the relevant updated .inc files, but I cannot add them to the uses. What else is needed to be changed?

Thanks,

 

TinyPortal © 2005-2018