How to Install MySQL in Ubuntu Server?

By Hardik Savani May 1, 2024 Category : Ubuntu Server


Today, i will let you know example of how to install mysql in ubuntu. We will look at example of how to install mysql in ubuntu 20.04 using terminal. i explained simply about ubuntu install mysql server example. let’s discuss about install mysql in ubuntu server.

In this post, i will give you simple list of commands how to install mysql server in ubuntu linux server. so let's see simple terminal command for install mysql in ubuntu ubuntu 21.10, ubuntu 21.04, ubuntu 20.04, ubuntu 18.04 and ubuntu 16.04.

Install MySQL on Ubuntu

Update Local Package:

sudo apt update

Install MySQL Server:

sudo apt install mysql-server

you can see terminal layout as bellow:

Access MySQL:

Now you can access mysql by using mysql command:

sudo mysql


mysql -u root

you can see terminal layout as bellow:

MySQL Status:

you can check status of mysql server

systemctl status mysql.service

Create User on MySQL:

you can create new user for mysql by using following query:

sudo mysql

CREATE USER 'root_new'@'localhost' IDENTIFIED BY 'rootnewpassword';

GRANT ALL PRIVILEGES ON * . * TO 'root_new'@'localhost';


I hope it can help you....

Tags :