Set up and configure our DBMS of choice, MYSQL, to store and manage data. Additionally setup user credentials validation and reset MySQL default users, databases, etc.
sudo apt install -y mysql-server
After installation, it's recommended to purge some insecure default settings and lock down access to the database system. The first thing we should do is set a password for the root
password (using mysql_native_password as our default authentication method**)** as by default it has none - a huge security risk.
Now we can finish the configuration using the mysql_secure_installation
script. We will be given a chance to update our password based on a VALIDATE PASSWORD PLUGIN to ensure some level of security for all database credentials. I will opt for the MEDIUM level (1) but for a production project I advise the STRONG (2) one.
sudo mysql_secure_installation
The last step is doing a cleanup and resets of the default users, databases, privileges, etc that MySQL has baked in.
Finally, let's test that we as root
require a password to access the MySQL console: