How to Install mysql server 5.7 on Ubuntu 16.04

MySQL is a popular database management system used for my web applications, How do I install MySQL server version 5.7 on Ubuntu Linux 16.04?, we can answer this question by following this tutorial which it will show to use how to install SQL 5.7 step by step.

1. After you had logged on your Ubuntu server, do a right click and click on “Open Terminal Here”, or you can select it from Ubuntu icon on the top bar, make sure that you are the root user.

2. Once you open “Terminal”, write the below 2 commands to update your system library.
sudo apt update”
sudo apt upgrade”

3. Run the below command on terminal to install mysql.
sudo apt install mysql-server mysql-client”

4. Write a password for your root account of MySQL.

5. After the installation is done, Run your SQL using the below code to secure the installation, it will prompt for your Root password which we had set on the above step.

“sudo mysql_secure_installation”

let’s try to log on your SQL Database

6. Write the below command on the terminal to log on your SQL Database.

“mysql -u root -p”

7. Create New SQL Database server and user account, using the below commands.

mysql> create database AvoidErrors;
mysql> grant all on AvoidErrorS.* to ‘Admin’ identified by ‘TYPE YOUR PASSWORD HERE’;
mysql> quit;

8. Now login with your “Admin” user, using below command, and “foobarpwd-8-4-2” as your password.

mysql -u Admin -p AvoidErrors


9. To start your MySQL server, write in “Terminal, “sudo systemctl start mysql.service”.

10. To stop your MySQL server for a maintenance or hardware upgrade, write on “Terminal”, “sudo systemctl stop mysql.service”.

now your SQL service is stopped.

11. To restart your SQL server, “sudo systemctl restart mysql.service”.

12. To check if your SQL server is running or not, “sudo systemctl status mysql.service”.

13. To reset your root account password, “sudo dpkg-reconfigure mysql-server-5.7”.

mysql> use mysql;
mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit


I started this tech blog back in 2011 as a place to write down processes I took to fix my client systems and network. Now I write some tips and tricks to help others with the tech issues that one might encounter.

You may also like...