Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MariaDB / QMySqlDriver connection without SSL got 2026 error
Qt 6.11 is out! See what's new in the release blog

MariaDB / QMySqlDriver connection without SSL got 2026 error

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mediendynamik.de
    wrote on last edited by
    #1

    My problem:

    A MariaDB-Server is running in a LAMPP-Installation
    It runs by default without SSL!

    A Qt-Application (both 5.15.2 and 6.10.1) with loaded QMARIADB-Driver tried to open a connection to the server and stopped with this error message:

    QSqlError("2026", "QMYSQL: Unable to connect", "TLS/SSL error: SSL is required, but the server does not support it")
    

    My aim is to connect locally WITHOUT SSL!
    Installing SSL in MariaDB is no an option.

    MariaDB Server is in fact running well without SSL and accepts connections by phpMyAdmin.
    But with QMySqlDriver in case of MariaDB (not MySQL) there is no connectOption parameter to switch off SSL on client size.

    According to mariadb documentation, a local connection (filesocket!) should work without enforement of SSL.

    This is the disfunction in question.

    The QMySqlDriver connectOption 'MYSQL_OPT_SSL_MODE' ist rejected in case of MariaDB.
    The mariadb client can be switched in my.conf with:

    [Client]
    skip-ssl=true
    

    But that is not interpreted by QMySqlDriver, which is instructed by connectOption() parameters.
    In qsql_mysql.cpp you can find:

    #if defined(MYSQL_VERSION_ID) && MYSQL_VERSION_ID >= 50711 
                 && !defined(MARIADB_VERSION_ID)
            {"MYSQL_OPT_SSL_MODE"_L1,   MYSQL_OPT_SSL_MODE,  setOptionSslMode},
    #endif
    

    By this MariaDB is excluded from getting this parameter.

    (1) This error appears both on 5.15.2 and 6.10.1 compilation of the Application.
    (2) It appears on new LAMPP 8.2.12 (2025), NOT on old LAMPP 7.4.2 (2020)
    both with MariaDB (new 10.4.32, old 10.4.11)

    MariaDB is able to connect locally without SSL (by phpmyadmin), QMySqlDriver is not serving this opportunity.

    Has anyone experiences with or solutions to this problem?

    Thanks in advance!


    My context:
    SuSE 16 Installation
    Qt: 5.15.2 and 6.10.1

    New (with error):
    LAMPP 8.2.12 from 11/2025

    • MariaDB 10.4.32
    • libmariadb.so.3 (3.1.22?)
    • MariaDB runs without SSL by default
    • OpenSSL 1.1.1

    Old (without error):
    LAMPP 7.4.2-0 from 2020-01-30

    • Apache 2.4.41
    • MariaDB 10.4.11
    • OpenSSL 1.1.1d
    • PHP 7.4.2
    • phpMyAdmin 5.0.1

    MariaDB Docu SSL

    LoKo

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      This is due to https://mariadb.com/docs/server/security/securing-mariadb/encryption/data-in-transit-encryption/securing-connections-for-client-and-server
      You can disable the check by setting the connect option MYSQL_OPT_SSL_VERIFY_SERVER_CERT=FALSE.
      And yes, MariaDB simply does not provide the MYSQL_OPT_SSL_MODE so you can't set it in the Qt plugin either: https://github.com/mariadb-corporation/mariadb-connector-c/blob/3.4/include/mysql.h#L184

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mediendynamik.de
        wrote on last edited by
        #3

        Hello Mister Ehrlicher!

        @Christian-Ehrlicher said in MariaDB / QMySqlDriver connection without SSL got 2026 error:

        You can disable the check by setting the connect option MYSQL_OPT_SSL_VERIFY_SERVER_CERT=FALSE.

        This is not working:

        OK!  SQL Treiber: "QMYSQL" "MySQL"
        QMYSQLDriver::open: Illegal connect option value 'MYSQL_OPT_SSL_VERIFY_SERVER_CERT=FALSE'
        *** keine Verbindung: "werkbank" QSqlError("2026", "QMYSQL: Unable to connect", "TLS/SSL error: SSL is required, but the server does not support it")
        

        In qsql_mysql.cpp this parameter is not supported.

        LoKo

        hskoglundH 1 Reply Last reply
        1
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Qt5 is no longer supported and therefore this option is not available there. Upgrade or change your server to allow unencrypted connections.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • M mediendynamik.de

            Hello Mister Ehrlicher!

            @Christian-Ehrlicher said in MariaDB / QMySqlDriver connection without SSL got 2026 error:

            You can disable the check by setting the connect option MYSQL_OPT_SSL_VERIFY_SERVER_CERT=FALSE.

            This is not working:

            OK!  SQL Treiber: "QMYSQL" "MySQL"
            QMYSQLDriver::open: Illegal connect option value 'MYSQL_OPT_SSL_VERIFY_SERVER_CERT=FALSE'
            *** keine Verbindung: "werkbank" QSqlError("2026", "QMYSQL: Unable to connect", "TLS/SSL error: SSL is required, but the server does not support it")
            

            In qsql_mysql.cpp this parameter is not supported.

            hskoglundH Offline
            hskoglundH Offline
            hskoglund
            wrote on last edited by
            #5

            @mediendynamik.de You're sue you cannot go with One-Way TLS for MariaDB Clients? (That way both phpMyAdnin and Qt6 clients should be able to connect.)

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mediendynamik.de
              wrote on last edited by
              #6

              Thanks for you help!

              (1) The best solution seams to be:

              int main(int argc, char *argv[])
              	{
              	qputenv("MARIADB_TLS_DISABLE_PEER_VERIFICATION","1");
              	// must be inserted before the constructor call of QCoreApplication
              	QApplication a(argc, argv);
                  // ...
                  }
              

              This works for 5.(15.2) and 6.(10.1) both with minimal efforts.

              (2) Adding an connectOptions() part:

              MYSQL_OPT_SSL_VERIFY_SERVER_CERT = 0
              

              works only for 6.(10.1)

              LoKo

              1 Reply Last reply
              0
              • goldenhawkingG Offline
                goldenhawkingG Offline
                goldenhawking
                wrote last edited by goldenhawking
                #7

                Yee, That's the reason. As above, Source code of qsqlmysql plugin only supports a few connection options from https://dev.mysqlserver.cn/doc/c-api/8.4/en/mysql-options.html . MYSQL_OPT_SSL_MODE=SSL_MODE_DISABLED can disable SSL. But this option is NOT supported with "if" blocks in qsqlmysql codes.

                MYSQL_OPT_SSL_MODE=SSL_MODE_DISABLED is important because that an OLD version mysql db contains large data may be still valuable.

                In https://doc.qt.io/qt-6/sql-driver.html#qmysql-for-mysql-or-mariadb-5-6-and-higher
                MYSQL_OPT_SSL_MODE is marked as SUPPORTED, this is a problem.

                Qt is the best C++ framework I've ever met.

                Christian EhrlicherC 1 Reply Last reply
                0
                • goldenhawkingG goldenhawking

                  Yee, That's the reason. As above, Source code of qsqlmysql plugin only supports a few connection options from https://dev.mysqlserver.cn/doc/c-api/8.4/en/mysql-options.html . MYSQL_OPT_SSL_MODE=SSL_MODE_DISABLED can disable SSL. But this option is NOT supported with "if" blocks in qsqlmysql codes.

                  MYSQL_OPT_SSL_MODE=SSL_MODE_DISABLED is important because that an OLD version mysql db contains large data may be still valuable.

                  In https://doc.qt.io/qt-6/sql-driver.html#qmysql-for-mysql-or-mariadb-5-6-and-higher
                  MYSQL_OPT_SSL_MODE is marked as SUPPORTED, this is a problem.

                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote last edited by
                  #8

                  @goldenhawking I'm not sure what you want to tell us but wrt MYSQL_OPT_SSL_MODE - the doc explicitly states: "Only available when linked against MySQL 5.7.10 or higher." which matches the actual source code ( https://github.com/qt/qtbase/blob/dev/src/plugins/sqldrivers/mysql/qsql_mysql.cpp#L1227 ).

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  goldenhawkingG 1 Reply Last reply
                  1
                  • Christian EhrlicherC Christian Ehrlicher

                    @goldenhawking I'm not sure what you want to tell us but wrt MYSQL_OPT_SSL_MODE - the doc explicitly states: "Only available when linked against MySQL 5.7.10 or higher." which matches the actual source code ( https://github.com/qt/qtbase/blob/dev/src/plugins/sqldrivers/mysql/qsql_mysql.cpp#L1227 ).

                    goldenhawkingG Offline
                    goldenhawkingG Offline
                    goldenhawking
                    wrote last edited by
                    #9

                    @Christian-Ehrlicher Got it.
                    Quick sidebar: Let’s be real—MySQL just hasn’t had PostgreSQL’s cultural mindshare these past few years in the tech ecosystem.

                    Qt is the best C++ framework I've ever met.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved