How to Install MySQL on Ubuntu 20.04

Spread the love

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

Install MySQL on Ubuntu 22.04
Install MySQL on Ubuntu 20.04
Permanently Remove, Uninstall MySQL from Ubuntu
Fix MySQL root password setup error in ubuntu
Reset or Change the MySQL root Password on Ubuntu

1 thought on “How to Install MySQL on Ubuntu 20.04”

  1. visit my webpage

    “Everything is very open with a clear explanation of the challenges. It was definitely informative. Your website is extremely helpful. Thank you for sharing!}”

Leave a Comment

Your email address will not be published.

Disclosure: This website is supports by its reader. This means, if you buy any product / service through link on this website, we may earn a small commision withought costing you extra. Learn how you can support Us and why we need this?