MySQL is among the most useful open-source database management systems with SQL, which is developed and supported by Oracle. Generally, MySQL is employed for accessing and modifying database information at all levels in database-related work, ranging from the information in a shopping list to the information of the users of a social network. In this guide, we are going to discuss how to install MySQL in Ubuntu 18.04 distribution.

Create and Connect to an Ubuntu Instance

The instructions below will help you to create and connect to an instance based on the Ubuntu distribution:

Installing MySQL on Ubuntu 18.04 LTS

Having created and connected to an instance based on the Ubuntu distribution, the apt-get must be updated to the latest version for installing MySQL. For this purpose, you can use the following command.

sudo apt-get update

In the next step, MySQL will be installed using the following command and allocating 160 MB.

sudo apt-get install mysql-server

When the installation is complete, you need to configure the built-in MySQL by using the following command.

sudo mysql_secure_installation

The first thing to do in this step is to identify the root user. You are recommended to answer all questions in this step using the y keyword. Nevertheless, be careful when asked “Remove the test database and access to it,” when using the y keyword, the MySQL test database will be removed.

After you complete the above step, MySQL will be running, and you can use the following command to verify that it is working as it should.

systemctl status mysql.service

In the end, you may check the installed MySQL information, like the version and so on, with the following command:

sudo mysqladmin –p –u root version