How to Install MySQL on Ubuntu 22.04

Install MySQL on Ubuntu 22.04

In this article, we will have explained the necessary steps to install MySQL on Ubuntu 22.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

MySQL is an open-source relational database management system. This relational database management system is used for many content management systems that are used to store the data, for example, WordPress.


  • Operating System with Ubuntu 22.04
  • Server IPv4 Address with Superuser Privileges (Root Access)
  • Gnome Terminal for Linux Desktop
  • PuTTy SSH client for Windows or macOS
  • Powershell for Windows 10/11
  • Familiar with APT Commands

Install MySQL on Ubuntu 22.04 LTS

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade
sudo apt install software-properties-common dirmngr apt-transport-https

Step 2. Install MySQL Database on Ubuntu Linux.

Installing MySQL on your Ubuntu 22.04 Jammy Jellyfish system is straightforward, Use the following command to install MySQL’s latest version in the Ubuntu system:

sudo apt install mysql-server

Once the MySQL installation is completed, the MySQL service will start automatically. To verify that the MySQL server is running, execute the following command on the command prompt:

mysql --version

Step 3. Secure MySQL Installation.

We need to secure installed MySQL by running the following command below:

sudo mysql_secure_installation


Install MySQL on Ubuntu 22.04 LTS

Step 3. Login Database Server.

Once success installation and securing of the same is completed, we can log in to our MySQL server with a root user:

mysql -u root -p

That’s all you need to do to install MySQL on Ubuntu 22.04 LTS Jammy Jellyfish. I hope you find this quick tip helpful. For further reading on the installation of the MySQL database server, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.