Preparing MySQL for Jira

Now that you have MySQL installed, you need to create a user for Jira to connect MySQL with as you should never use the default root user, and then create a fresh database for Jira to store all its data:

  1. Start the MySQL Command Line Client by navigating to StartAll ProgramsMySQLMySQL Server 5.7MySQL 5.7 Command Line Client.
  2. Enter the MySQL root user password you set during installation.
  3. Use the following command to create a database:
        create database jiradb character set utf8;
  1. Here, we are creating a database called jiradb. You can name the database anything you like. As you will see later in this chapter, this name will be referenced when you connect JIRA to MySQL. We have also set the database to use utf8 character encoding, as this is a requirement for JIRA. Using the following command, you need to ensure that the database uses the InnoDB storage engine to avoid data corruption:
        grant all on jiradb.* to 'jirauser'@'localhost' 
        identified by 'jirauserpassword';

We are doing several things here. First, we create a user called jirauser and assign the password jirauserpassword to them. You should change the username and password to something else.

We have also granted all the privileges to the user for the jiradb database that we just created so that the user can perform database operations, such as create/drop tables and insert/delete data. If you have named your database something other than jiradb, then make sure that you change the command so that it uses the name of your database.

This allows you to control the fact that only authorized users (specified in the preceding command) are able to access the Jira database to ensure data security and integrity.

  1. To verify your setup, exit the current interactive session by issuing the following command:
        quit;
  1. Start a new interactive session with your newly created user:
        mysql -u jirauser -p
  1. You will be prompted for a password, which you set up in the preceding command as jirauser.
  1. Use the following command:
        show databases;

This will list all the databases that are currently accessible by the logged-in user. You should see jiradb among the list of databases.

  1. Examine the jiradb database by issuing the following commands:
        use jiradb;
        show tables;

The first command connects you to the jiradb database, so all of your subsequent commands will be executed against the correct database.

The second command lists all the tables that exist in the jiradb database. Right now, the list should be empty, since no tables have been created for JIRA; but don't worry, as soon as we connect to Jira, all the tables will automatically be created.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset