This document describes how to connect JIRA to a mysql database. Check whether the MySQL version is supported and the supported platform. If you want to migrate JIRA to another server, export the data as an XML backup, and then transmit the data from the old database to the new database. If you plan to use this document to connect JIRA to the mysql database.
Check whether the MySQL version is supported and the supported platform. If you want to migrate JIRA to another server, export the data as an XML backup, and then transmit the data from the old database to the new database. If you plan to use the same MySQL server to install Confluence and JIRA, read the Confluence MySQL installation guide and configure your MySQL server to adapt to Confluence and JIRA. Note that Confluence is stricter than JIRA, so MySQL should be configured to adapt to Confluence. This configuration also applies to JIRA. Disable JIRA before starting, unless you are running Setup Wizard. 1. create and configure a MySQL database to create a database user (login role) connected to JIRA, for example, jiradbuser.
Mysql> CREATE user' <USERNAME> '@' <JIRA_SERVER_HOSTNAME> 'identified BY '<PASSWORD>'; creates a database (such as jiradb) to store JIRA problems, the database must have a UTF8 character set. On the MySQL command client, enter the following command:
Create database jiradb character set utf8 COLLATE utf8_bin; make sure that the user has the permission to connect to the DATABASE and CREATE and write tables. The authorization command is as follows:
Grant select, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX on <JIRADB>. *
'<USERNAME>' @ '<JIRA_SERVER_HOSTNAME> 'identified' ';
Flush privileges;
Tip:
To confirm whether the permission is granted successfully, log on to the DB server with the jira db user and run the following command:
Show grants for <USERNAME >@< JIRA_SERVER_HOSTNAME>; 2. copy the MySQL JDBC driver to the application server.
Skip this step if you are upgrading JIRA and using the recommended MySQL drive (Connector/j jdbc driver v5.1. The JIRA update automatically copies an existing driver to the upgraded version.
Copy the MySQL JDBC driver to your application server
Obtain the MySQL driver: if JIRA is installed, download the recommended MySQL driver Connector/j jdbc driver v5.1.
You can download the .tar.gzor. zip file by selecting 'platform independent. Extract jar (for example, mysql-connector-java-5.x.x-bin.jar) from the archive for the driver ). If you are upgrading JIRA without using the recommended MySQL driver (JDBC ctor/J 5.1), back up the driver from JIRA before the update. The driver will be stored in /Lib/directory. Copy the MySQL JDBC driver /Lib/directory to update JIRA. If you use windows installer to install JIRA, you need to do this step after running Windows installer, but before running Setup Wizard. Restart the JIRA/JIRA server. If JIRA is being installed, skip other instructions on this page and connect to JIRA through a browser to run Setup Wizard. Note: the MySQL ctor/J driver recommended above has been reported by users to have encountered Resin JDBC driver for MySQL problems. 3. configure the JIRA server to connect to the MySQL database
Three methods to configure the JIRA server to connect to the MySQL database:
Use the JIRA installation wizard (not applicable to jira war)-If you have installed JIRA and set it for the first time, your settings will be saved to the dbconfig. xml file in the JIRA main directory. Use the JIRA configuration tool (not applicable to jira war)-If an existing JIRA instance exists, your settings will be saved to the dbconfig. xml file in the JIRA main directory. Manual configuration-you can use this method to link to the JIRA server only when you have a jira war instance or console. You need to manually update the dbconfig. xml file in the JIRA main directory.
Description of each configuration method:
The JIRA setup wizard appears when JIRA is connected to the browser for the first time. On the 'configure Language and database' page, set the Database Connection to My own Database. Set Database Type to MySQL. Fill in fields according to the following database connection fields. Test the connection and save it. Run JIRA configuration tool as follows: Windows: open a command prompt and run the bin subdirectory file config. bat in the JIRA installation directory. Linux/Unix: Open the console and run the bin subdirectory file config. sh in the JIRA installation directory.
JIRA Tutorial: connect to the database-MySQL
An error may occur. refer to the solution in this article. Navigate to the Database tab and set Database type to MySQL. Fill in fields according to the following database connection fields. Test the connection and save it. Restart JIRA. Manually, find the dbconfig. xml file in the root directory of the JIRA main directory. If the file does not exist, create the file and copy and paste the XML sample code (as follows) to the file. Update the file according to the following database connection fields. Add the 'amp;' escape all '&' character at each end. Note: The element must specify the database type, such as mysql. If you forget to specify the database type and start JIRA, the database table will not be correctly created. If you encounter a similar problem, see specifying an incorrect database type to solve the problem. Save the file and restart JIRA.
Database Connection field:
Setup wizard/configuration tool dbconfig. xml Description Hostname is located in the <url> Flag (For example, the following bold text ):
<Url> jdbc: mysql: // dbserver: 3306/jiradb? UseUnicode = true & characterEncoding = UTF8 & sessionVariables = storage_engine = InnoDB </url> specifies the name or IP address of the machine on which the MySQL server is installed. Port is in the <url> Flag (For example, the following bold text ):
<Url> jdbc: mysql: // dbserver: 3306/jiradb? UseUnicode = true & characterEncoding = UTF8 & sessionVariables = storage_engine = InnoDB </url> The TCP/IP port that the MySQL server is listening. You can also leave it blank to use the default port. The Database is located in the <; url> mark (for example, the following bold text ):
<Url> jdbc: mysql: // dbserver: 3306/jiradb? UseUnicode = true & characterEncoding = UTF8 & sessionVariables = storage_engine = InnoDB </url> name of the MySQL database (the database where JIRA data will be saved. It should be created in the first step above. Username is in the <username> mark (for example, the following bold characters ):
<Username> jiradbuser </username>: The user who connects to the MySQL server. It should be created in the first step above. The Password is in the <password> mark (for example, the following bold text ):
<Password> jiradbuser </password> is the user password used for authentication with the MySQL server.
Dbconfig. xml file example
4. start JIRA
Now JIRA is configured to connect to the MySQL database. The next step is to start JIRA.
If you are using JIRA's 'referended' allocation, start it and check whether there is an error in the log. If jira war allocation is used, re-build and redeploy the Web application on the application server. Known issues and solutions: the host name in the permission is equivalent to a string-if the host name authorized to be localhost in MySQL is localhost, the same string must be used to connect to the database from JIRA. Therefore, 127.0.0.1 cannot work, even though they point to the same address. This will generate an error where the table cannot be found, because when JIRA is started, the JDBC connection does not have the permission to create the table. Connection close-if you use any of the following to use the MySQL database, you may encounter a connection close problem (see the JRA-15731 for details ). Read volume Ving Connection Closures to solve the problem. JIRA 3.13 or above, version 5.5.25 or higher of Tomcat 5, version 6.0.13 or higher of Tomcat 6, special character of database password-JIRA cannot interpret special characters in database password, see set database password. Use the InnoDB storage engine-the default storage engine MyISAM is used from the previous MySQL Server version to 5.5. Therefore, data in JIRA may be corrupted when the JIRA database runs in the default MySQL server 5.5 or earlier versions. We strongly recommend that you specify the sessionVariables = storage_engine = InnoDB parameter in the database. This ensures that the table written to the MySQL database of JIRA uses the InnoDB storage engine, which supports the 'database transactions' required by JIRA '. Binary log-note that MySQL of JIRA uses the 'read-committed' transaction isolation level. Currently, only binary logs based on rows are supported. If you need the binary log feature of MySQL, you must configure the binary log format of MySQL as 'row-based '. Otherwise, an error may occur when creating a problem in JIRA. For details, you cannot create a problem when using MySQL binary logs. 4-byte characters-note that JIRA does not support MySQL to use 4-byte characters.