MySQL is the go-to database solution for local, free, individual or enterprise usage. Developed by Oracle corporation, Ubuntu 20.04 contains the latest stable release series of MySQL, viz. 8.*.

MySQL is being used worldwide on every popular platform. A rich set of MySQL connector APIs has been developed by open source communities worldwide for a large number of programming languages.

MySQL is required on your local machine if you want to install server-based software like WordPress or Drupal, which use MySQL database to store data. It is also required if you want to use it as a database for your development project. In this article, we will see how to install MySQL on Ubuntu 20.04 LTS.

Installation

MySQL server and client are packaged separately in Ubuntu repositories. They are available in packages mysql-server and mysql-client respectively. Let’s first update the Ubuntu repositories.

sudo apt update

Now we can install both MySQL client and server.

sudo apt install mysql-client mysql-server

Note that in production environments, usually the server is installed on a separate dedicated machine and only clients are installed on local machines.

If you are planning to query your MySQL database using a DB connector API from your code, you can skip the installation of MySQL client, however, it is recommended that you install it anyway as it helps in debugging.

Verifying the Installation

Let’s now verify if the MySQL client and server have been installed. To verify if the client has been installed, run:

mysql --version

Similarly, to verify if MySQL server has been installed successfully, run:

mysqld --version

MySQL server runs as a daemon, which can be invoked with the program mysqld or can be enabled as a background service using systemctl.


We have seen how to install MySQL on Ubuntu 20.04 in this article. MySQL is often installed as part of XAMP (X – Any Operating System, Apache, MySQL, PHP/Python/Perl) server software stacks. Such stacks make it easier to set up and configure everything required for a server software together. A common example is the setup of WordPress.

However, if you are using MySQL as a database application for your web development project, it is recommended that you install the MySQL server on a dedicated secure machine, and query the server from the client. This makes the maintenance of the database easier.