Home Linux How to Install MySQL 8.0 in Ubuntu 16.04 / 18.04

How to Install MySQL 8.0 in Ubuntu 16.04 / 18.04

I want to install MySQL 8.0 on Ubuntu VPS machine. How can I ??

MySQL community server is an open source free database management system. It is widely used nowadays and the process of installation MySQL 8.0 is very simple. In this article, will let you know how to install MySQL 8.0 in the Ubuntu 16.04 or 18.04 system.

Read More: Install MySQL 5.7 on Ubuntu 18.04.

Benefits :

1. MySQL 8.0 has a new type of backup lock.
2. JSON enhancements were done.
3. Security also enhanced.
4. MySQL replication also improved.
5. Moreover, additional windows features are added.

Step 1: Add MySQL Repository

To install MySQL 8.0 version on the Ubuntu system, need to add the repository. Firstly, need to download the repository package using the wget command.

# wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb 

After downloading it, will install the package using the dpkg command.

# sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb 

During the installation, you will be asked to choose the MySQL version and other features like cluster, shared client libraries, or the MySQL workbench.

Configuring mysql-apt-config

Step 2 : Install MySQL 8.0

Now it’s time to update the source package in the repository. You can update the system.

#  sudo apt-get update

Finally, you can run the MySQL installation command.

# sudo apt-get install mysql-server
Install MySQL Server on Ubuntu Command
Install MySQL in Ubuntu Command

This command will start the installation process and will ask for a few things like entering a password for the root user of MySQL.

Enter Root User Password for Database
Enter Root User Password for Database

Afterwards, next screen display the message of MySQL uses authentication method.

Configuring mysql-community server
Configuring mysql-community server

Afterwards, choose the default authentication plugin and click on ok. As shown in the following screenshot.

Select default authentication plugin
Select default authentication plugin

Step 3 : Secure MySQL

Most important thing is to secure the database server. Question is how can you secure the database server? The answer is quite simple. Below are the few points mentioned to secure database server.
– Set the strong password for the database user.
– Disable root user login remotely
– Remove test database and access to it
– Additionally, you can change the default MySQL port number.

Run the following command to secure MySQL :

# sudo mysql_secure_installation
Output of mysql_secure_installation
Output of mysql_secure_installation

Step 4 : Manage MySQL Service

To Check the status of MySQL service on Ubuntu, just run the following command:

$ sudo systemctl status mysql
MySQL service status output
MySQL service status output

Start the MySQL service :

$ sudo systemctl start mysql

Moreover, enable service on boot :

$ sudo systemctl enable mysql

Step 5 : Connect MySQL from Terminal :

Finally, you can connect to database from the terminal.

$ sudo mysql -u root -p
Connect MySQL from Terminal on Ubuntu
Connect MySQL from Terminal on Ubuntu

In fact, you can also use phpmyadmin graphical tool to manage database.

Conclusion: You have successfully learned how to install, configure and secure MySQL 8.0 on Ubuntu system. For any feedback, kindly use the below comment box.


Please enter your comment!
Please enter your name here