
Ubuntu 20.04 comes with MySQL 8.0 as the default package. But, sometimes, you need MySQL 5.7 for your legacy apps that don't support MySQL 8.0 yet. This tutorial explains how to add MySQL 5.7 package and install it on Ubuntu 20.04.
Before you begin, you should :
Because Ubuntu 20.04 only has MySQL 8.0 in the APT repository, you need to add MySQL 5.7 repository first before installing it. Download MySQL repository using the following commands :
Once it's downloaded, install the repository :
In the prompt, choose the Ubuntu Bionic. And then select the MySQL Server & Cluster option. After that, choose mysql-5.7 and then select ok.
After it's finished, update the APT repository :
If you encounter the "signature couldn't be verified" error like this :
You need to import the missing gpg key with the following command :
After that, rerun the apt update :
Check if MySQL 5.7 repository is successfully installed by using this command :
You should see MySQL 5.7 repository appearing at the bottom of the list.
After you have MySQL 5.7 repository in your system, you can install it using the apt install :
Press the Y key to start the installation and set the root password when prompted.
Before using MySQL 5.7 in production, you should secure it first. You can do that by running this command :
Enter your MySQL root password and answer all of the security questions.
To check whether or not you installed the correct MySQL version. First, connect to MySQL with the root password that you set earlier.
And then run this command :
You should see your installed MySQL version.
Congratulation, you have successfully installed MySQL 5.7 on your Ubuntu 20.04 server.
0 Comments
Be the first to comment and share your perspective with the community.