Documentation for JIRA 4.4. Documentation for other versions of JIRA is available too. 
![]()
These instructions will help you connect JIRA to a MySQL 5.x database.
Note: A Linux-specific version of these instructions is available.
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 are using a MySQL database with any of the following:
you may experience problems with your connections dropping out (see http://jira.atlassian.com/browse/JRA-15731 for details). Please read Surviving Connection Closures for information on the changes required to your application server to address this.
If you experience any other issues with using JIRA and MySQL, please refer to our additional notes for more information.
On this page:
jiradbuser). 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:
create database jiradb character set utf8;
(if you want your database to be named jiradb). Remember this database name, as it will be used to configure JIRA's connection to this database in subsequent steps.
Skip this step if you are using JIRA Standalone distribution. JIRA Standalone includes the MySQL JDBC driver.
mysql-connector-java-5.x.x-bin.jar) to the lib/ directory.There are two ways to configure your JIRA server to connect to your MySQL database:
Please Note:
The JIRA Configuration Tool is only available with JIRA Standalone.
config.bat in the bin subdirectory of the JIRA Installation Directory.config.sh in the bin subdirectory of the JIRA Installation Directory. Please Note: You may need to set the
JAVA_HOME environment variable to run the JIRA Configuration Tool. See Installing Java for details.
To connect JIRA to MySQL using the JIRA Configuration Tool:
dbconfig.xml file in your JIRA Home Directory. This tool also adds 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.sessionVariables=storage_engine=InnoDB' parameter into the database URL of the dbconfig.xml file it saves. This parameter is strongly recommended when configuring JIRA with MySQL, to avoid data corruption in JIRA. See the Additional Notes section below for more information.dbconfig.xml file generated in your JIRA Home Directory to add this parameter manually, as shown in the example XML code below. (Remember to separate each parameter in your database URL with an '&' character, which must be 'escaped' by adding 'amp;'.)Congratulations — you have finished! Proceed to 'Next Steps' below.
Edit 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 below into this file and edit the pasted XML as required.
When editing your
dbconfig.xml file, escape the '&' characters by adding 'amp;' to the end of each one, as shown in the <url/>element below:
<?xml version="1.0" encoding="UTF-8"?>
<jira-database-config>
<name>defaultDS</name>
<delegator-name>default</delegator-name>
<database-type>mysql</database-type>
<schema-name></schema-name>
<jdbc-datasource>
<url>jdbc:mysql://dbserver:3306/jiradb?useUnicode=true&characterEncoding=utf8&sessionVariables=storage_engine=InnoDB</url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<username>jiradbuser</username>
<password>[enter db password]</password>
<pool-size>15</pool-size>
<validation-query>select 1</validation-query>
</jdbc-datasource>
</jira-database-config>
Please Note:
dbconfig.xml file content above assumes a UTF-8 database — i.e. that your database was created using a command similar to create database jiradb character set utf8;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.<validation-query>select 1</validation-query> element is usually required when configuring JIRA with default MySQL installations. See Surviving Connection Closures for more information.sessionVariables=storage_engine=InnoDB parameter to the database URL is strongly recommended when configuring JIRA with MySQL, to avoid data corruption. See the Additional Notes section below for more information.dbconfig.xml file (at the root of your JIRA Home Directory).Proceed to 'Next Steps' below.
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.
Hence, specifying the sessionVariables=storage_engine=InnoDB parameter in your database URL (by following the procedures above) is strongly recommended. Doing so ensures that tables written to JIRA's MySQL database will use the InnoDB storage engine, which supports 'database transactions' required by JIRA.
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.
You should now have JIRA configured to connect to your MySQL database.
Please see JIRA and MySQL.