3.3 - Configure Database

Configuring the Database

In order to install Convention Master, it needs a MySQL database in which to store its data. We need to create a database on your system, and a MySQL user account to access it. This section of the guide will run you through that process.

If you already have a blank database provisioned on your host/by your hosting company, skip this step and proceed to the next page.

  1. If you have not previously done so, run the MySQL installation security wizard. This will help you set password policies, a root password for the system, disable unneeded access methods, etc.

    sudo mysql_secure_installation

  2. We need to disable some mode switches in MySQL in order for Convention Master to function. Let's go ahead and make a custom MySQL configuration file for Convention Master:

    sudo joe /etc/mysql/mysql.conf.d/convention_master.cnf

  3. In this file, place the following two lines:

    [mysqld]
    sql-mode="NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

  4. Save the new file and close. To activate it, let's restart the MySQL service:

    sudo systemctl restart mysql

  5. Next, let's create the database and user account Convention Master needs to install itself. Execute the following command to log into MySQL as its super-user (root):

    sudo mysql

  6. You should see the MySQL monitor's interactive prompt. From here we can create a new database for Convention Master:

    CREATE DATABASE convention_master;

  7. Finally, let's create a user that can access this database:

    GRANT ALL PRIVILEGES ON convention_master.* TO CMUser@localhost IDENTIFIED BY 'yourpasswordgoeshere';
    FLUSH PRIVILEGES;

All done! With the database and user created, we can proceed to installing Convention Master.