To install MySQL on ubuntu you have to follow the steps given below:-
Step 1: Type the following command on your Ubuntu machine.
sudo apt-get update
sudo apt-get install mysql-server
Step 2: The installation will start and you will be prompted to set a password.
You have to re-enter the password.
Step 3: Your installation is complete. Now run the following command.
To allow remote access to your MySQL server,
sudo ufw allow mysql
To start mysql service
systemctl start mysql
To launch MySQL after reboot
systemctl enable mysql
Step 4: All done now let's start MySQL. Type the following command:
/usr/bin/mysql -u root -p
It will prompt you for password.
Now you can use MySQL. Hope this helps.