Installing MySQL

This section provides a step-by-step guide to installing MySQL.

To install MySQL and create a database, follow the steps below:

  1. Install the MySQL server.
    yum install mysql-server
  2. Enable the MySQL server.
    systemctl enable mysqld
  3. Connect a MySQL database server as the root user.
    mysql -u root
  4. Create a database named vrm in MySQL.
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sys                |
    | vrm                |
    +--------------------+
    5 rows in set (0.00 sec)
    
  5. Create three users as admin, cdpapp and cdpapp_ro users along with permissions as shown below.
    CREATE USER 'admin'@'%' IDENTIFIED BY '<password>'
    GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
    CREATE USER 'cdpapp_rw'@'%' IDENTIFIED BY '<password>'
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, RELOAD, REFERENCES, INDEX ON *.* TO `cdpapp_rw`@`%` WITH GRANT OPTION;
    CREATE USER 'cdpapp_ro'@'%' IDENTIFIED BY '<password>'
    GRANT SELECT ON *.* TO `cdpapp_ro`@`%` WITH GRANT OPTION;
    FLUSH PRIVILEGES;
  6. Finally, copy the initial data dump in the database.
    # mysql -u <user> -p -P <Port> -D vrm < <path_to_dumpfile> eg. vrm_schema_only_dump.sql
    # mysql -u <user> -p -P <Port>-D vrm < <path_to_dumpfile> eg. db_dump.sql