MySQL is a free and open source database, that you can use on your personal project or production websites to store your data.
Installing MySQL in Ubuntu is quite simple, and you can do so by downloading the official mysql package.
In this tutorial, you will learn how to install MySQL on Ubuntu 22.04.
Install MySQL on Ubuntu 22.04
Step 1 - Update before installation
Before installing MySQL on your machine, make sure that your package index is updated, so that you are able to get the latest mysql package that is available on official Ubuntu repository.
To update your Ubuntu machine, simply run the command below.
sudo apt update
Step 2 - Install MySQL
Now that your package index is updated, you can proceed to install MySQL on your system.
MySQL can be installed on Ubuntu by using apt package manager, as the official package of MySQL is available on the universe repository of Ubuntu 22.04.
To install MySQL, run the following.
sudo apt install mysql-server
Step 3 - Verify MySQL Installation
Before starting MySQL server on your machine, make sure that MySQL is able to run.
To check if you are able to use MySQL, perform a simple test by checking the version of mysql that was installed.
To do so, run the command below.
Uninstall MySQL on Ubuntu 22.04
MySQL can be easily removed from your machine, by simply removing the installed package, in this case the package that was is installed is
So to uninstall MySQL, issue the following command.
sudo apt remove mysql-server
In this tutorial, you learned how to install and uninstall MySQL on Ubuntu 22.04.
Even though we used Ubuntu 22.04 for this tutorial, this tutorial applies also to the following versions of Ubuntu : Ubuntu 20.04, Ubuntu 22.04, Ubuntu 23.04 and Ubuntu 23.10.
You should be able to use MySQL on your machine now.