non TLS connection to mySQL using fpc mysql55 wrapper lazarus / 16-Databases ---------------------------------------------------------------------- Triplex · 2025-08-27 20:58 Hello guys Lazarus 4.2 on openSUSE Linux 15.6 I created a sandbox database and am trying to connect using the Free Pascal mysql55.pp wrapper, which utilizes libmysqlclient.so (Linux) or libmysql.dll (Windows). Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses mysql55;var MySQL : PMYSQL;......MySQL := mysql_init(MySQL);//  MySQL^.options.use_ssl := 0; if mysql_real_connect(MySQL, 'sql7.freesqldatabase.com', 'sql7796276', 'g3SKXnkJ5R', 'sql7796276', 0, Nil, 0) = nil then  ShowMessage(IntToStr(mysql_errno(MySQL)) + ' ' + mysql_error(MySQL));.... Resutl is an error: 2026 TLS/SSL error: SSL is required, but the server does not support it How to disable SSL/TLS ? Tried setting MySQL^.Options.Use_SSL := 0;, but no luck. Linux CLi mysql connected succesfully to database and STATUS show that TLS not in use Code: [Select]mysql -h sql7.freesqldatabase.com -u sql7796276 -p'g3SKXnkJ5R' sql7796276 Welcome to the MariaDB monitor.  Commands end with ; or \g. Your MySQL connection id is 99369004 Server version: 5.5.62-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [sql7796276]> status -------------- mysql  Ver 15.1 Distrib 10.11.11-MariaDB, for Linux (x86_64) using  EditLine wrapper Connection id:          99369004 Current database:       sql7796276 Current user:           sql7796276@mm-222-14-212-37.vitebsk.dynamic.pppoe.byfly.by SSL:                    Not in use Current pager:          less Using outfile:          '' Using delimiter:        ; Server:                 MySQL Server version:         5.5.62-0ubuntu0.14.04.1 (Ubuntu) Protocol version:       10 Connection:             sql7.freesqldatabase.com via TCP/IP Server characterset:    latin1 Db     characterset:    latin1 Client characterset:    utf8 Conn.  characterset:    utf8 TCP port:               3306 Uptime:                 6 days 9 hours 58 min 35 sec Threads: 69  Questions: 9393157  Slow queries: 159  Opens: 274221  Flush tables: 1  Open tables: 400  Queries per second avg: 16.945 -------------- P.S. Checked on Windows with libmysql.dll in project folder and its connected succesfully... ---------------------------------------------------------------------- Zvoni · 2025-08-28 06:59 1) connect with the commandline-client, and enter SHOW VARIABLES and look for TLS Maybe it's activated via the my.inf 2) You connect to Port 0 ???? Seriously? Quotefrom MySQL.com: Code: C  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i MYSQL *mysql_real_connect(MYSQL *mysql,                   const char *host,                   const char *user,                   const char *passwd,                   const char *db,                   unsigned int port,                   const char *unix_socket,                   unsigned long client_flag) if mysql_real_connect(MySQL, 'sql7.freesqldatabase.com', 'sql7796276', 'g3SKXnkJ5R', 'sql7796276', 0, Nil, 0) = nil thenEDIT2: Forget what i wrote. Just realized you connect to an online Database, exposed by a webserver EDIT: Found something: https://dev.mysql.com/doc/c-api/8.4/en/mysql-real-connect.html about half way down QuoteCLIENT_SSL: Use SSL (encrypted protocol). Do not set this option within an application program; it is set internally in the client library. Instead, use mysql_options() before calling mysql_real_connect(). Maybe read out the options first: https://dev.mysql.com/doc/c-api/8.4/en/mysql-get-option.html ---------------------------------------------------------------------- Triplex · 2025-08-28 12:41 Quote from: Zvoni on August 28, 2025, 08:59:07 amMaybe read out the options first: https://dev.mysql.com/doc/c-api/8.4/en/mysql-get-option.html Thx for the link, here is a bit mess in fpc sources and mysql docs 1. less than mysql57dyn function mysql_options is not implemented. ok i moved to v5.7 2. mysql57dyn has outdated MYSQL_OPT_SSL_ENFORCE option. According to the docs - option is deprecated as of MySQL 5.7.11 and is removed in MySQL 8.0. But i tried Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses mysql57dyn;var  SSLFlag : Integer; //also tried my_bool  MySQL : PMYSQL;...............begin  InitialiseMySQL; //load client library if dyn  SSLFlag := 0;  mysql_options(MySQL, MYSQL_OPT_SSL_ENFORCE, @SSLFlag);    if mysql_real_connect(MySQL, 'sql7.freesqldatabase.com', 'sql7796276', 'g3SKXnkJ5R', 'sql7796276', 0, Nil, 0) = nil then    begin      Str := IntToStr(mysql_errno(MySQL)) + ' ' + mysql_error(MySQL);      moLog.Lines.Add(Str);    end;   ReleaseMySQL;end. Still same result. 3. mysql80dyn has modern MYSQL_OPT_SSL_MODE ortion, but has no set of modes, required as option values  SSL_MODE_DISABLED, SSL_MODE_PREFERRED, SSL_MODE_REQUIRED etc. so i cant use it Any other ideas? Is it possible because my libmysqlclient.so is a symlink to libmariadb.so.3 ? Mayme i need setup MariaDB somehow? ---------------------------------------------------------------------- Triplex · 2025-08-28 13:01 Upd: Fount modes in c++ connector sources Code: [Select]enum ssl_mode {   SSL_MODE_DISABLED= 1, SSL_MODE_PREFERRED, SSL_MODE_REQUIRED,   SSL_MODE_VERIFY_CA, SSL_MODE_VERIFY_IDENTITY }; Have a try, but still no luck Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses mysql80dyn;type  TSSLMode = (    SSL_MODE_DISABLED = 1,    SSL_MODE_PREFERRED,    SSL_MODE_REQUIRED,    SSL_MODE_VERIFY_CA,    SSL_MODE_VERIFY_IDENTITY  );       var  SSLFlag : Integer;   SSLMode : TSSLMode;  MySQL : PMYSQL;...............begin  InitialiseMySQL; //load client library if dyn  SSLFlag := 1;  SSLMode := SSL_MODE_DISABLED;   mysql_options(MySQL, MYSQL_OPT_SSL_MODE, @SSLMode); //also tried mysql_options(MySQL, MYSQL_OPT_SSL_MODE, @SSLFlag);   if mysql_real_connect(MySQL, 'sql7.freesqldatabase.com', 'sql7796276', 'g3SKXnkJ5R', 'sql7796276', 0, Nil, 0) = nil then    begin      Str := IntToStr(mysql_errno(MySQL)) + ' ' + mysql_error(MySQL);      moLog.Lines.Add(Str);    end;   ReleaseMySQL;end. ---------------------------------------------------------------------- Zvoni · 2025-08-28 13:42 I've just lookd into the source of mysql.inc and found this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //Line 1795function mysql_options(mysql:PMYSQL; option:mysql_option; arg:Pchar):cint;extdecl;external mysqllib name 'mysql_options'; //Line 1875mysql_options: function (mysql:PMYSQL; option:mysql_option; arg:Pchar):cint;extdecl; A PChar as 3rd parameter??? Try a hard cast to Integer-Pointer or raw pointer for 3rd Param EDIT: Looks like a bug to me ---------------------------------------------------------------------- Triplex · 2025-08-28 14:52 Solved. Issue was MariaDB. idk if its a bug or feature. Got the package mysql-libs-8.0.42-2.fc42.x86_64.rpm for Fedora that provide libmysqlclient.so.21 and copy it to usr/lib64 folder as libmysqlclient.so Txh alot