Load data from MySQL

This article explains how to connect to a MySQL database with Exasol and then load data.

To view details about data type mappings or to migrate data, see the MySQL to Exasol migration script in our GitHub repository.

Prerequisites

  • The MySQL server must be reachable from the Exasol system.

  • The user credentials in the connection must be valid.

Download driver

Download the JDBC driver for MySQL from the MySQL Connectors page. In the Select Operating System dropdown menu, select Platform Independent.

Add JDBC driver

Create a configuration file called settings.cfg with the following settings:

Copy
DRIVERNAME=MySQL
PREFIX=jdbc:mysql:
FETCHSIZE=-2147483648
INSERTSIZE=-1
NOSECURITY=YES

To know how to upload the JDBC driver and the configuration file to BucketFS, see Add JDBC Driver.

Create connection

To create a connection, run the following statement. Replace the connection string and credentials as needed.

The MySQL user must have enough privileges to create a connection.

Copy
CREATE OR REPLACE CONNECTION JDBC_MYSQL
    TO 'jdbc:mysql://192.168.99.100:3306/my_database' 
    USER 'user_name'
    IDENTIFIED BY 'my_password';

To test the connection, run the following statement.

Copy
select * from 
(
import from JDBC at JDBC_MYSQL
statement 'select ''Connection works'' from dual'
);

Load data

Use IMPORT to load data from a table or SQL statement using the connection that you created.