How to Install MySQL on Ubuntu 22.04

UbuntuHow to Install MySQL on Ubuntu 22.04

In the modern big data ecosystem, MySQL is one of the most well-known technologies. It is also referred to as a popular and effective database across many industries. To master this database management system, only a basic understanding is required. Even if you are unfamiliar with relational systems, you can create secure, fast, and powerful storage systems with MySQL.

This write-up will discuss the procedure to install MySQL on Ubuntu 22.04. So, let’s start!

How to install MySQL on Ubuntu 22.04

To install MySQL on Ubuntu 22.04, you must follow the below-given step-by-step instructions.


Sorry, the video player failed to load.(Error Code: 101102)

Step 1: Update system repositories

Press “CTRL+ALT+T” to open the terminal of the Ubuntu 22.04 and run the below-given command to update system repositories:

Step 2: Install MySQL on Ubuntu 22.04

In the next step, install the MySQL on your system with the help of the following command:

$ sudo apt-get install mysql-server

Wait for a few minutes as the installation of the MySQL will take some time to complete:

Step 3: Verify MySQL service status

Then, check the status of the “mysql” service:

$ systemctl is-active mysql

The given output signifies that “mysql” service is currently active and running on our Ubuntu 22.04 system:

Step 4: Configure MySQL server

Now, write out the below-given command for performing an initial and interactive configuration of the MySQL server:

$ sudo mysql_secure_installation

In the configuration manual, you will be first asked to set the level for the password validation policy. Input a number from the given menu according to your password validation requirements:

After doing so, type out the new password for “root” and enter “y” to continue with the provided password:

Also, set the other configuration options accordingly:

Step 5: Log in to MySQL server

Next, log in to the MySQL server for setting the default authentication method to “mysql_native_password” and specify a native password for the root:

As you can see, the following query will set the root password to “Password123#@!” and the authentication method to “mysql_native_password”:

> ALTER USER ‘root’@’localhost’

IDENTIFIED WITH mysql_native_password BY ‘Password123#@!’;

Reload the grant tables in the MySQL database so that the changes can be applied without restarting the “mysql” service:

Again, try to login into the MySQL with the password you have set previously:

The above-given error-free output signifies that we have successfully installed and configured MySQL on our Ubuntu 22.04 system.

Lastly, to assure that the MySQL service is active, execute the following command:

$ systemctl status mysql.service

We have compiled the method to install MySQL on Ubuntu 22.04. Give it a try and work on this fantastic database management system.




Be the first to comment

Leave a Reply

Your email address will not be published.