Skip to main content
Version: 8.1

Connecting to MySQL

Inductive University

Connecting to MySQL

Watch the video

On this page we'll demonstrate how to connect Ignition to MySQL.

MariaDB Connections to MySQL Databases​

Ignition can use the built-in MariaDB driver to connect to MySQL 5.7 and prior databases. This circumvents the need to manually provide a JAR file to the MySQL JDBC Driver configuration on the Gateway.

New in 8.1.2

Ignition version 8.1.2 includes a MariaDB driver that can connect to MySQL 8 databases. Note that upgrading Ignition does not replace existing JDBC drivers. See the JDBC Drivers and Translators page for more information.

MySQL Connector/J Connections to MySQL Databases​

Should you choose to to connect to a MySQL database using the official MySQL JDBC Driver, you will need to install the driver. New Ignition installations do not have the driver (a JAR file), so you will have to acquire the file yourself. See the JDBC Drivers and Translators page for more details on obtaining the required file.

Once acquired, you can follow the steps for Upgrading a JDBC Driver. Once the JAR file has been provided, you can follow the steps listed on this page to configure a connection between Ignition and MySQL.

Connect Ignition to MySQL Database​

  1. On the Gateway Webpage, go to the Config section.

  2. Scroll down to Databases > Connections.

    " "

  3. Click on Create new Database Connection....

    " "

  4. Select the MySQL driver and click Next. You may need to install a JDBC driver for MySQL.

    " "

    note

    Alternatively, you may select the MariaDB driver, and use that to connect to MySQL. See the MariaDB Connections to MySQL Databases section above.

  5. On the New Database Connection page, enter the following information:

    • Name: MySQL (use a meaningful name such as MySQL)

    • Connect URL: jdbc:mysql://localhost:3306/test (By default, MySQL creates an empty database called test)

    " "

    As you see in the example above, MySQL uses the following Connect URL format: jdbc:mysqldb://hostaddress:3306/database

    Where hostaddress is the address of the machine with MySQL installed, for example: localhost, 192.168.1.1, db-server, etc. Database specifies the database schema the connection will target. The connection will target one schema (a collection of tables and other objects) in the database.

  6. To configure the connection, Ignition needs credentials to connect to MySQL. The Username and Password fields are where you provide credentials for a user that Ignition will use to authenticate against the database. The user should be able to do the following:

    1. Create and drop tables within the schema
    2. Alter tables within the schema
    3. Insert, update, select, and delete rows from tables in the schema
    4. Create, alter, and execute stored procedures within the schema
  7. After entering a username and password, click on Create New Database Connection at the bottom of the form. Your connection is now created and the Database Connections page is displayed showing the Status of your connection as Valid.

    " "

  8. To display the details about the status of your database connection, click on the Database Connection Status link in the page note. This will display any errors if your status is Faulted, in this example it shows the status as being Valid.