17.7 C
Texas
angeloma
Senior Writer and partner

How to install MySQL 8 on Ubuntu 18.04?

MySQL is one of those applauses that we can consider critical on a server. This is due to the fact that MySQL is a data manager and therefore, it can be assumed that critical applications use it. So, having MySQL updated with its latest versions becomes a necessary task to avoid surprises with our data. That’s why in this post, I will show you how to install MySQL 8 on Ubuntu 18.04.

MySQL 8

MySQL 8 is the latest large version of this powerful database manager. It comes with big improvements in the security section to compete with MariaDB which is a fork of this project. But not only that but at a more professional level has a better infrastructure to perform the replication process.

On the other hand, this version increases its performance in handling very large databases. It adds support to Unicode and other things. Of course, many bugs solved and security patches added.

As you can see, it is almost a necessity to have this version.

How to install MySQL 8 on Ubuntu 18.04

- Advertisement -

To install this version in our Ubuntu 18.04 system, we can have a dedicated MySQL repository. This is great news because we can do the installation from APT being quite safe and fast.

First, connect to your server using SSH or just open a terminal. Then, using wget, download the .DEB file that adds the repository. Then, install it.

:~$ wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
:~$ sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

During the installation process, we will be shown a screen where we can configure which MySQL product we want. In our case, we want version 8 and it will be selected by default. So just scroll with the arrows on the keyboard and press enter on the OK option.

1.- Configure MySQL APT repository
1.- Configure MySQL APT repository

After that, just refresh APT and then install MySQL 8.

:~$ sudo apt update && sudo apt install mysql-server

During the installation process, you will be asked to define the password of the root user.

2.- Set the root password
2.- Set the root password

Then, we will be informed that the MySQL authentication methods have been improved and we will be asked if we want to activate this feature or use the old one that is compatible with MySQL 5.7.

3.- Configure MySQL 8
3.- Configure MySQL 8

So this is installed. However, we can do several more things.

To improve MySQL security, we can use the mysql_secure_installation script. There we will be asked a question to change MySQL settings.

:~$ sudo mysql_secure_installation

The questions are as follows:

Remove anonymous users?
Disallow root login remotely?
Remove test database and access to it?
Reload privilege tables now?

4.- Secure MySQL 8 installation
4.- Secure MySQL 8 installation

You can answer yes or no according to the case.

Now, you have to prove that MySQL 8 has been installed correctly. To do this, it is necessary to enter the MySQL console.

:~$ sudo mysql -u root -p
Enter Password:
Welcome to the MySQL Monitor

Then, let’s make a query of the created databases.

>show databases;

5.- Test MySQL installation
5.- Test MySQL installation

And that’s it.

Conclusion

In this post, you have learned to install MySQL 8 on Ubuntu 18.04. The process is greatly facilitated thanks to MySQL’s APT repository which makes it fast and secure. However, it is a process that requires knowledge of Linux and its terminal. In spite of this, it is very recommendable to do it because it improves the security and we will be able to count on a robust and current application.

Please share this post with your friends.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

2 COMMENTS

  1. I don’t recommend vanilla MySQL, better take MariaDB. For that part the acquisition of the installer differs since they use a PPA.

    • You’re right. However, in many places, they still prefer MySQL over MariaDB. In addition, the brand “MySQL” is even better known than MariaDB.

      Thanks for comment.

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article