SQLines Data - Configure and Troubleshoot Connection to MySQL

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

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

Before downloading check if you already have MySQL libraries:

  • Linux:
    • /usr/lib/mysql/libmysqlclient.so
    • /usr/lib64/mysql/libmysqlclient.so
  • Windows: (Drive letter and version can be different)
    • C:\Program Files\MySQL\MySQL Server 5.7\lib\libmysql.dll
    • C:\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.dll

If MySQL client is not available, go to MySQL Download page https://dev.mysql.com/downloads/connector/ and download MySQL Connector/C.

Installing MySQL Connector/C on Linux

Download the latest version of MySQL Connector/C, for example, mysql-connector-c-6.1.9-linux-glibc2.5-x86_64.tar.gz and extract files:

tar -xvzf mysql-connector-c-6.1.9-linux-glibc2.5-x86_64.tar.gz

You can find libmysqlclient.so library at lib directory. Before running sqldata command, add MySQL library location to LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<mysql_connector_dir>/lib

An alternative way to install MySQL libraries is to run:

yum install mysql-devel

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

cd <mysql_connector_dir>/lib
ln -s libmysqlclient.so.16 libmysqlclient.so

Troubleshooting Connection on Windows

When you click Test Connection you get the following error:

  • Error Loading MySQL C API libmysql.dll. The specified module could not be found

Possible reasons:

  • MySQL C API is installed but SQLines Data tool cannot find libmysql.dll for some reason. Add the directory where libmysql.dll is located (for example, C:\Program Files\MySQL\MySQL Connector C 6.1\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.

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