Install MySQL

Nothing clever in the installation.

Simply used yum to install MariaDB (open source version of MySQL)

#yum install mariadb mariadb-server

Check the Biblio page of this book - I found some good articles about the whole process and I did some extra stuff then for security:

First start the database server:

#systemctl start mariadb

Then run a script to allow us to lock it down a bit better

#mysql-secure-installation

Enter a password for root when prompted and hit Enter (to accept) at the rest of the prompts. This removes a load of default stuff that has security implications

Next change the root user name to something harder to guess

#mysql -u root -p

Enter the new root password you created running the script above


MariaDB [(none)]> use mysql;
MariaDB [mysql]> RENAME USER 'root'@'localhost' TO 'sqladmin'@localhost';
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> quit

This has changed the 'name' of the admin user for MariaDB to sqladmin (you should probably make up a different name). The password remains whatever was set when the security script was run.

Set the database server to start at boot:

#systemctl enable mariadb

MySQL/MariaDB is now installed & running