Steps to install MySQL on Ubuntu Server

After setting up the server, issue the below command to install mysql and its associated libraries

$ apt-get install mysql-server mysql-client libmysqlclient12-dev

Edit MySQL configuration file, to set the IP address that will be dedicated for MySQL.

$ vi /etc/mysql/my.cnf

Uncomment the line that states
#bind-address = 127.0.0.1

Now restart MySQL by typing the below command
$ /etc/init.d/mysql restart

Root password will be blank initially. To change it use:
$ /etc/init.d/mysql reset-password

Give the new password and verify the password again.

To test if the password has been set, you can try
$ mysql -uroot -p

and then wait for the prompt for password entry. This ensures that password has been sent for root account in MySQL.