Login to your Ubuntu server with root user with your favorite SSH client
Let’s first update the operating system with all the latest packages with the command
sudo apt-get update
In order to install mysql use the command as below
apt-get install mysql-server php5-mysql
On the next screen , set the root password for Mysql server , Use the tab to move the cursor on OK button and press enter.
We are done with installing Mysql
Let’s configure and secure the Mysql server in order to use it with the commands
mysql_install_db
mysql_secure_installation
In order to secure the Mysql installation you will need to answer a series of questions as below
Enter current password for root (enter for none): Provide the root password
Change the root password n
Remove anonymous users Y
Remove anonymous users Y
Disallow root logins remotely Y
Disallow root login remotely Y
Remove test database and access to it Y
And reload privilege tables Y
Reload privilege tables now Y
We are done with securing the Mysql server installation. Let’s verify it with the command
mysql –V
Lets restart the Mysql service with the command
service mysql restart
You are done.