MySQL is an open-source relational database management system under the terms of the GNU General Public License. Its name is a combination of “My”, the name of co-founder Michael Widenius’s daughter, and “SQL”, the abbreviation for Structured Query Language. In this tutorial, you will learn how to install MySQL on ubuntu 20.04

Install MySQL on Ubuntu

sudo apt update
sudo apt install mysql-server

install mysql-server

2. Check MySQL Version

mysql --version

mysql Version

3. Secure MySQL and set the password

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough.

sudo mysql_secure_installation

mysql secure installation

This will take you through a series of prompts where you can set your MySQL installation’s security options. The first prompt will ask you Would you like to setup VALIDATE PASSWORD component?  Press Y and hit Enter to set password.

Second prompt will ask you levels of password validation policy. There are Three levels of Policy:

Level 0:

Level 1: numeric, mixed case, and special characters

Level 2: numeric, mixed case, special characters and dictionary file

You can choose from 0,1,2 as your requirement. 0 is for least secure and 2 is for most secure. Here I am entering 0.

The third and Fourth prompts will ask you for New Password and Re-enter new password. Enter password as per level rule.


mysql password format

Now you have set a password for the root MySQL user.

Now, It will ask you a series of questions, Answer as per your customisation.

Remove anonymous users?

Disallow root login remotely?

Remove test database and access to it?

Reload privilege tables now?

mysql Permission

Check MySQL Status

sudo systemctl status mysql

systemctl status mysql

Login to MySQL

Login as root

On MySQL 8.0, the root user is authenticated by the auth_socket plugin by default. So, you can login to MySQL without password. Just use sudo mysql command in terminal.

sudo mysql

You can also login using sudo mysql -u root -p command in terminal. Here you need to enter the password. This method is valid for all MySQL versions.

sudo mysql -u root -p

For root (sudo) User

mysql -u root -p

mysql -u root -p

BB Price
Per Share (₹)
Issue Size
Shares (Cr)
Issue Size
Amount (₹-Cr)
eClerx Services3 Feb
Technocraft Industries1 Feb
Kama Holdings31 Jan13 Feb23 Dec 20221450050.03
Tips Industries27 Jan
Cosmo First27 Jan
Triveni Turbine17 Jan
Sharing is Caring

Comments are closed.

Scroll to Top