The latest official documentation on configuring JIRA with MySQL can be found in the Connecting JIRA to MySQL guide.
This is a step-by-step supplement guide for setting up your MySQL database for JIRA. Although this guide assumes that your MySQL database server is running on Linux, the various procedures described below can be adapted (or may be applicable) to other similar operating systems.
Enable MySQL TCP/IP networking
Some Linux distributions (eg. Debian) disable MySQL's TCP/IP networking as a security precaution. You can test that MySQL is listening on the default port (3306) as follows:
Or if netstat isn't available:
On Debian, you can enable MySQL TCP connections by editing /etc/my.cnf, commenting out the 'skip-networking' flag, and restarting mysqld.
Create MySQL database and user
Create a MySQL user called 'jirauser' and database called 'jiradb':
The 'IDENTIFIED BY' phrase sets the password for the user (in this case, 'mypassword'). Your hostname may be different; you will find out in the next steps.
Now verify that user 'jirauser' can connect:
If you get errors like:
You will need to adjust the 'host' field for the JIRA user record:
See also Atlassian's MySQL Tips.
If problems persist, see the MySQL Causes of Access Denied Errors page.
For more general information, see Adding New User Accounts to MySQL.
Start JIRA
Check for errors in the log files.
Again, if you see an 'Access denied' error:
Then you need to adjust your /etc/hosts so that 'localhost' comes before 'localhost.localdomain', and restart MySQL. This is a MySQL bug fixed in 5.0.11.
Run the Setup Wizard
Point a browser at http://localhost:8080/, and set up JIRA as described in the Setup Wizard.
Troubleshooting
Q: I get the following error message in MySQL, "Attempted reconnect 3 times. Giving up." What should I do?
A: MySQL error message
To troubleshoot your MySQL connection, please follow the steps below:
- Enter the following command to connect to MySQL:
For example,
- If you cannot connect to MySQL after entering your password, login to your mysql with the root account:
And enter following command:where,
<dbname>is your database name,
<user>is your database user name,
<password>is your database password.
Do not forget the last command: 'FLUSH PRIVILEGES'
- If you still cannot connect, please check that your MySQL is listening on the default port of
3306and bind in your IP,127.0.0.1by running either of the following commands:or,If MySQL is listening, you should see the following message:Alternatively, you also could check if your MySQL is listening on the default port by running this command:







6 Comments
Hide/Show CommentsFeb 02, 2008
Adam Fisk
This is a great tutorial. I've just posted a little script I made in part based on this, that automates the process of configuring JIRA for MySQL, including creating the database, configuring the jira user, unpacking the jira tgz, etc. It's for JIRA standalone only, but it saves time. It also allows you to easily customize your JIRA port if you wish.
I write about it in more detail at on my blog. Makes setting up JIRA for MySQL dead simple!
Jan 21, 2009
Anonymous
Please make sure to start mysqld with the option
--default-table-type=InnoDBto use InnoDB as default engine. MyISAM does not support transactions and will cause corrupt workflows on errors.Feb 09, 2010
Dirk Brilhart
I agree with Adam above that this is an extremely helpful set of instructions for using standalone Jira on Linux with MySQL.. I recently migrated a Jira installation from one Red Hat server to another and upgraded from Jira 3.12 to 4.0.1. Both Jira instances are standalone using MySQL databases. In reading the Atlassian documentation, I found that the information I needed was spread across several different parts of the Installation and Upgrade Guide, and in some cases, the documentation made different suggestions at different places. I thought I would post what worked for me:
The task was to migrate a Jira 3.12 installation on one server to Jira 4.0.1 on a different server. After installing JDK 1.6 and MySQL 5.0, these are the steps that we followed:
- as the jira user, install the new version of jira with the default configuration
- start jira to make sure all is well. Connect to host:8080 and also check out the catalina.out log file.
- create an empty mysql database and add a user as mentioned above
- copy the jdbc connector jar file to common/lib
- update the Jira configuration to match the old version ... don't copy files, edit the files. This includes entityengine.xml, osuser.xml, jira-application.properties, and server.xml.
- export the old jira data as XML and copy the file to the new machine
- restart jira. If all is well, when you go to localhost:8080, you will get the configuration set up page with an option to import data from an existing installation. Go with the import data option.
- enter a Jira 4.0 license key that is associated with the OLD installation's server id
- import the XML file ... it takes several minutes to load.
- Reload localhost:8080 and check the logs to make sure all is working properly.
Apr 20, 2010
Dave Burns
Re anonymous's comment above, I recommend before creating the jira database that you set your MySQL defaults to InnoDB and UTF-8 server-wide. This can save a lot pf pain later. To do this, edit /etc/my.cnf and add the following two lines in the [mysqld] section:
Then restart your MySQL instance with:
Dec 07, 2010
Michael P. Gower
For Ubuntu 10.04 you want to edit /etc/mysql/my.cnf.
You may need to install with:
Then you can restart with:
Apr 27, 2010
Robert Withrow
The suggestion to change the Jira user to have host "localhost.localdomain" cause Jira to not start on Ubuntu Karmic. Leaving it as is (i.e. "localhost") works just fine.
Add Comment