MySQL is an open source software for the Relational Database Management System. MySQL is one of the server application packages for websites that are often referred to as LAMP (Linux Apache MySQL PHP) servers.
*0.Install MySQL Repository*
By default the MySQL version available on Ubuntu 18.04 is MySQL 5.7.
apt show mysql-server v5.7
In order to be able to install MySQL 8 on Ubuntu 18.04 first, install the MySQL 8 repository.
Download the repository file configuration file MySQL 8.[INPUT]
1 curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
Installing the downloaded .deb file.[INPUT]
1 sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
The question *Which MySQL product do you want to configure?* is displayed, select *Ok*.
Run the update.[INPUT]
1 sudo apt update
Verify the mysql-server version.[INPUT]
1 apt show mysql-server
apt show mysql-server v8.0
After the MySQL repository is installed, run the MySQL server installation.[INPUT]
1 sudo apt install mysql-server -y
Enter the MySQL root user password.
Enter root password
Select *Use Strong Password Encryption (RECOMENDED)*.
Choose the authentication plugin
After installation is complete, check the mysql service status, it must *active (running)*.[INPUT]
1 sudo systemctl status mysql
mysql service status
*2.Securing the MySQL server installation*
Securing the MySQL server installation[INPUT]
1 sudo mysql_secure_installation
Enter the user’s root password.[INPUT]
1 2 3 Securing the MySQL server deployment. Enter password for user root: PASSWORD_ROOT
VALIDATE PASSWORD COMPONENT to use a strong MySQL user password. Answer *y* if you want to activate it.[INPUT]
1 2 3 4 5 6 VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: y
Choose a password strength level.[INPUT]
1 2 3 4 5 6 7 There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter = LOW, 1 = MEDIUM and 2 = STRONG: 1
Changing the root password, answer *n* if you don’t want to change it.[INPUT]
1 2 Estimated strength of the password: Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
Remove anonymous users, answer *y*.[INPUT]
1 2 3 By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Do not allow root to remote database, answer .[INPUT]
1 2 3 Normally, root should only be allowed to connect from ‘localhost’. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove the test database, answer *y*.[INPUT]
1 2 3 By default, MySQL comes with a database named ‘test’ that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload tabel privileges, answer *y*.[INPUT]
1 2 3 Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Login to MySQL with the root user.[INPUT]
1 sudo mysql -u root -p
Login to mysql
Good luck ð