SQLines Data - Configure and Troubleshoot Connection to MariaDB

If you are going to connect to a localhost MariaDB database you do not need to setup any additional libraries to use SQLines Data tool as they are supplied with MariaDB server.

If you need to connect to a remote MariaDB database, you need to have MariaDB C API libmariadb installed in your system.

Before downloading check if you already have MariaDB libraries:

  • Linux:
    • /usr/lib64/libmariadb.so
  • Windows: (Drive letter and version can be different)
    • C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib\libmariadb.dll

If the MariaDB client is not available, go to MariaDB Download page https://mariadb.com/downloads/connectors/ and download MariaDB Connector C.

Installing MariaDB Connector/C on Linux

To install MariaDB libraries run:

  # Fedora
  dnf install mariadb-connector-c

Before running sqldata command, add the MariaDB library location to LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<mariadb_connector_dir>/lib

If your .so file ends with the library version, for example, libmariadb.so.3 then create a symbolic link, so SQLines Data tool is able to load the required library:

  cd <mariadb_connector_dir>/lib
  ln -s libmariadb.so.3 libmariadb.so

Setup SSL Connection

When connecting to a MariaDB database you can get the following error: SSL connection is required. Please specify SSL options and retry”

Use SSL connection options in sqldata.cfg or command line:

  • -mariadb_ssl_verify_server_cert - SSL connection mode, possible values are 1 (enable SSL) and 0 (disable SSL)
  • -mariadb_ssl_key - SSL private key file (–ssl-key MySQL option), the absolute path to the file
  • -mariadb_ssl_cert - SSL certificate file (–ssl-cert MySQL option), the absolute path to the file in PEM format
  • -mariadb_ssl_ca - SSL CA file (–ssl-ca option of MySQL CLI), the absolute path to the file in PEM format

Troubleshooting Connection on Windows

When you click Test Connection you get the following error:

  • Error Loading MariaDB C API libmariadb.dll. The specified module could not be found

Possible reasons:

  • MariaDB C API is not installed. Downlaod and install MariaDB C API client (MariaDB Connector C) at http://www.mariadb.com
  • MariaDB C API is installed but SQLines Data tool cannot find libmariadb.dll for some reason. Add the directory where libmariadb.dll is located (for example, C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib) to the PATH environment variable and restart SQLines Data tool.

To set the PATH variable on Windows, right-click the Computer icon, select Properties, click the Advanced System Settings. Then select Advanced tab and click the Environment Variables button. Go to System Variables, find and append Path.

Instead of the system PATH variable, you can also specify the path to MariaDB library using the -mariadb_lib option of SQLines Data configuration file sqldata.cfg. For example, you can set -mariadb_lib=C:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib\libmariadb.dll

Troubleshooting Connection

  • Error: TLS/SSL error: SSL is required, but the server does not support it

Set the MARIADB_TLS_DISABLE_PEER_VERIFICATION environment variable to disable SSL on the client.

  export MARIADB_TLS_DISABLE_PEER_VERIFICATION=1 
  • ERROR 3159 (08004): Connections using insecure transport are prohibited while –require_secure_transport=ON.

Enable SSL connections using MariaDB SSL options mentioned above.

Contact us at support@sqlines.com if you still have any connection problems.