Documentation for JIRA 5.2. Documentation for other versions of JIRA is available too. 
![]()
These instructions will help you connect JIRA to a MySQL 5.x database.
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 COLLATE utf8_bin;
(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.
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:
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on <JIRADB>.* TO '<USERNAME>'@'<JIRA_SERVER_HOSTNAME>' IDENTIFIED BY '<PASSWORD>'; flush privileges;
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:
.tar.gz or the .zip file. Extract the jar for the driver (e.g. mysql-connector-java-5.x.x-bin.jar) from the archive.JIRA installation directory>/lib/ directory.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 WizardPlease note:
There are two ways to configure your JIRA server to connect to your MySQL database:
Please Note:
The JIRA Configuration Tool is not available with JIRA WAR distributions.
config.bat in the bin sub-directory of the JIRA Installation Directory.config.sh in the bin sub-directory of the JIRA Installation Directory.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.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>
<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>password</password>
<pool-min-size>20</pool-min-size>
<pool-max-size>20</pool-max-size>
<pool-max-wait>30000</pool-max-wait>
<validation-query>select 1</validation-query>
<min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis>
<time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis>
<pool-max-idle>20</pool-max-idle>
<pool-remove-abandoned>true</pool-remove-abandoned>
<pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
<pool-test-while-idle>true</pool-test-while-idle>
<validation-query-timeout>3</validation-query-timeout>
</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.<jdbc-datasource/> beginning with pool in the dbconfig.xml file above, or any others not described in this topic, see Tuning Database Connections.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.
See JIRA and MySQL. Please also take note of the following:
6 Comments
Anonymous
Feb 06, 2013Seriously, why isn't the process of database connection in JIRA identical to Confluence. Crazy.
SusanA
Feb 07, 2013Sorry you are finding this process frustrating. You might want to report this as an issue on https://jira.atlassian.com/secure/Dashboard.jspa to bring your concerns to the attention of the Product Managers for JIRA.
Anonymous
Feb 11, 2013your link is broken in 3.1 : Connector/J JDBC driver v5.1. doesn't point to anything
Where may I find the connector ?
Anonymous
Feb 11, 2013oops, seems it's just for me (according to http://www.downforeveryoneorjustme.com/http://dev.mysql.com/downloads/connector/j ), I may have some DNS problem on this site.
Joe Gilvary
Mar 13, 2013Does the MySQL jar go into the JIRA installation directory/lib (which doesn't exist when I build Jira) or into the tomcat/lib? The link back on Installing JIRA on Tomcat 6.0 or 7.0 says "Copy the MySQL JDBC Driver to Your Application Server."
Football Coalition
Mar 16, 2013Why isn't the MySQL driver JAR bundled with JIRA? Didn't it used to be, in the past?