Connecting JIRA to MySQL

These instructions will help you connect JIRA to a MySQL database. A version of these instructions specific to Linux and JIRA is available.

Before you begin

  • Check whether your version of MySQL is supported. See Supported Platforms.
  • If you are Migrating JIRA to Another Server, create an export of your data as an XML backup. You will then be able to transfer data from your old database to your new database, as described in Switching databases.
  • If you plan to set up Confluence and JIRA on the same MySQL server, please read the Confluence MySQL setup guide and configure your MySQL server to suit Confluence as well as JIRA. Note that the Confluence requirements are more strict than JIRA's, so you should configure MySQL to suit Confluence. This configuration will work for JIRA too.
  • Shut down JIRA before you begin, unless you are running the Setup Wizard.

On this page:

1. Create and configure the MySQL database

  1. Create a database user which JIRA will connect as (e.g. jiradbuser).
    Remember this database user name, as it will be used to configure JIRA's connection to this database in subsequent steps. 

  2. Create a database for JIRA to store issues in (e.g. jiradb). The database must have a character set of UTF8. Enter the following command from within the MySQL command client.
    Remember this database name, as it will be used to configure JIRA's connection to this database in subsequent steps.


    (if you want your database to be named jiradb). 

  3. Ensure that the user has permission to connect to the database, and permission to create and populate tables. These can be provided with the following:

    flush privileges;


    To confirm if the permissions were granted successfully, log into the DB server with the JIRA DB user and run the command below:

  4. Edit the my.cnf file (my.ini on Windows operating systems) in your MySQL server. (Refer to MySQL Option Files for detailed instructions on editing my.cnf and my.ini.)
    Locate the [mysqld]section in the file, and add or modify the following parameters:

    • Set the default storage engine to InnoDB:

    • Specify the value of max_allowed_packet to be at least 256M:

    • Specify the value of innodb_log_file_size to be at least 256M for MySQL 5.5 and below:


      NB: This should be set to at least 2G for MySQL 5.6 and above.

    • Ensure the sql_mode parameter does not specify NO_AUTO_VALUE_ON_ZERO

      // remove this if it exists
      sql_mode = NO_AUTO_VALUE_ON_ZERO
  5. Restart your MySQL server for the changes to take effect:

    • On Windows, use the Windows Services manager to restart the service.
    • On Linux:
      • Run one of the following commands, depending on your setup: '/etc/init.d/mysqld stop' or '/etc/init.d/mysql stop' or 'service mysqld stop'.
      • Then run the same command again, replacing 'stop' with 'start'.

2. Copy the MySQL JDBC driver to your application server

If you are upgrading JIRA and you are using the recommended MySQL driver (Connector/J JDBC driver v5.1), you can skip the instructions in this section. The JIRA upgrade task will automatically copy over your existing driver to the upgraded installation.

To copy the MySQL JDBC driver to your application server:

  1. Get the MySQL driver:
    • If you are installing JIRA, download the recommended MySQL Connector/J JDBC driver v5.1.
      You can download either the .tar.gz or the .zip file by selecting the 'Platform Independent' option. Extract the jar for the driver (e.g. mysql-connector-java-5.x.x-bin.jar) from the archive.
    • If you are upgrading JIRA and you are not using the recommended MySQL driver (JDBC Connector/J 5.1), back up the driver from your JIRA installation before you upgrade.
      The driver will be in the <JIRA installation directory>/lib/ directory.
  2. Copy the MySQL JDBC driver jar to the <JIRA installation directory>/lib/ directory for your new/upgraded installation. If you are installing JIRA using the Windows installer, you will need to do this step after running the Windows installer, but before running the Setup Wizard.
  3. Restart JIRA / JIRA service.
  4. If you are installing JIRA, skip the rest of the instructions on this page and access JIRA in your browser to run the Setup Wizard instead.

Please note:

  • We recommend the Connector/J driver from MySQL (linked above). A user has reported experiencing problems with the Resin JDBC driver for MySQL.

3. Configure your JIRA server to connect to your MySQL database

There are three ways to configure your JIRA server to connect to your MySQL database:

  • Using the JIRA setup wizard (not applicable to JIRA WAR) — Use this method, if you have just installed JIRA and are setting it up for the first time. Your settings will be saved to the dbconfig.xml file in your JIRA Home Directory.
  • Using the JIRA configuration tool (not applicable to JIRA WAR) — Use this method, if you have an existing JIRA instance. Your settings will be saved to the dbconfig.xml file in your JIRA Home Directory.
  • Manually — Only use this method if you have a JIRA WAR instance or you have a console-only connection to your JIRA server. You will be required to manually update the dbconfig.xml file in your JIRA Home Directory.

Instructions for each configuration method

JIRA setup wizard

The JIRA setup wizard will display when you access JIRA for the first time in your browser.

  1. In the first screen, 'Configure Language and Database', set Database Connection to My own database.
  2. Set Database Type to MySQL.
  3. Fill out the fields, as described in the Database connection fields section below.
  4. Test your connection and save.

JIRA configuration tool

  1. Run the JIRA configuration tool as follows:
  2. Navigate to the Database tab and set Database type to MySQL.
  3. Fill out the fields, as described in the Database connection fields section below.
  4. Test your connection and save.
  5. Restart JIRA. 


  1. Locate the dbconfig.xml file at the root of your JIRA Home Directory.
    • If this file does not exist, create the file, copy and paste the example XML code (shown below) into this file.
  2. Update the file, as described in the Database connection fields section below. Escape any '&' characters by adding 'amp;' to the end of each one.
    • Note, the <database-type/> element must specify your type of database, e.g. mysql. If you forget to do this and you start JIRA, your database tables may be created incorrectly. See Incorrect database type specified if this happens to you.
  3. Save the file and restart JIRA.

Database connection fields

Setup Wizard / Configuration Tool dbconfig.xml Description

Located in the <url> tag (bold text in example below):

The name or IP address of the machine that the MySQL server is installed on.

Located in the <url> tag (bold text in example below):

The TCP/IP port that the MySQL server is listening on. You can leave this blank to use the default port.

Located in the <url> tag (bold text in example below):

The name of your MySQL database (into which JIRA will save its data). You should have created this in Step 1 above.

Located in the <username> tag (see bold text in example below):

The user that JIRA uses to connect to the MySQL server. You should have created this in Step 1 above.
Password Located in the <password> tag (see bold text in example below):
The user's password — used to authenticate with the MySQL server.

Sample dbconfig.xml file

  • For more information about the child elements of <jdbc-datasource/> beginning with pool in the dbconfig.xml file above, see Tuning Database Connections.
  • Both the JIRA setup wizard and database configuration tool also add the element <validation-query>select 1</validation-query> to this file, which is usually required when running JIRA with default MySQL installations. See Surviving Connection Closures for more information.
  • The database URL in the example below assumes a UTF-8 database — i.e. that your database was created using a command similar to create database jiradb character set utf8; If you do not specify character set utf8 when creating this database, you risk getting 'Data truncation: Data too long for column' errors when importing data or corruption of non-supported characters. See storing non-ASCII characters in MySQL for details.
  • The collation order of COLLATE utf8_bin is recommended for JIRA. More discussion of this can be seen at  JRA-21503 - JIRA is not fully compatible with case insensitive collation Resolved
  • The database URL in the example below contains the sessionVariables=storage_engine=InnoDB parameter. We strongly recommend adding this parameter to avoid data corruption. See the Installation Notes section below for more information.
  • For MySQL, the schema name (<schema-name>) is not used and should not be specified. If you provide a schema name, you could run into the problem described in the knowledge base article Incorrect MySQL Schema Used.
<?xml version="1.0" encoding="UTF-8"?>

    <validation-query>select 1</validation-query>

4. Start JIRA

You should now have JIRA configured to connect to your MySQL database. The next step is to start it up!

  • If you are using a 'recommended' distribution of JIRA, start it up and watch the logs for any errors.
  • If you are using the JIRA WAR distribution, rebuild and redeploy the webapp in your application server.

(tick) Congratulations, you now have JIRA connected to your MySQL database.

Installation notes

See JIRA and MySQL. Please also take note of the following:

Known issues and troubleshooting

  • Hostnames in permissions are compared as strings - If you grant permission in MySQL to a hostname such as localhost then you must use the same string for the connecting to the database from JIRA. So using won't work even though it resolves to the same place. This mistake produces warnings about not finding tables because the JDBC connection did not have permission to create the new tables when JIRA was set up.
  • Connection closures — If you are using a MySQL database with any of the following, you may experience problems with your connections dropping out (see JRA-15731 for details). Please read Surviving Connection Closures for information on how to address this.
    • JIRA 3.13 or above,
    • version 5.5.25 or higher of Tomcat 5,
    • version 6.0.13 or higher of Tomcat 6,
  • Special characters for database password — JIRA is not able to interpret special characters for database password. Please refer to additional hints about setting password for database here.
  • Using the InnoDB storage engine — The default storage engine used by MySQL Server versions prior to 5.5 is MyISAM. Hence, a JIRA database running on a default configuration of a MySQL Server earlier than version 5.5, could experience table creation problems (JRA-24124), which may result in data corruption in JIRA. We strongly recommend specifying the sessionVariables=storage_engine=InnoDB parameter in your database URL (as stated above). Doing so ensures that tables written to JIRA's MySQL database will use the InnoDB storage engine, which supports 'database transactions' required by JIRA.

  • Binary logging — Be aware that JIRA uses the 'READ-COMMITTED' transaction isolation level with MySQL, which currently only supports row-based binary logging. If you require MySQL's binary logging features, you must configure MySQL's binary logging format to be 'row-based'. If not, you may encounter problems when creating issues in JIRA. For more information, please refer to JIRA Cannot Create Issues when Using MySQL with Binary Logging.

  • 4 byte characters   Please note that JIRA does not support using MySQL with 4 byte characters.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport