Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Install MySQL 5.7 on Ubuntu 20.04

Rumi, January 9, 2024

Prerequisites

  • Linux servers running Ubuntu 20.04
  • root privileges

Step 1 – Add MySQL APT repository in Ubuntu

Ubuntu already comes with the default MySQL package repositories. In order to add or install the latest repositories, we are going to install package repositories . Download the repository using the below command:

sudo apt update
sudo apt install wget -y
wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb

Once downloaded, install the repository by running the command below:

sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb

In the prompt, choose Ubuntu Bionic and click Ok

The next prompt shows MySQL 8.0 chosen by default. Choose the first option and click OK

In the next prompt, select MySQL 5.7 server and click OK.

The next prompt selects MySQL5.7 by default. Choose the last otpion Ok and click OK

Step 2 – Update MySQL Repository on Ubuntu

Run the below command to update your system packages

sudo apt-get update

Now search for MySQL 5.7 using apt-cache as shown below:

sudo apt-cache policy mysql-server

As you can see MySQL 5.7.31-1ubuntu18.04 is appearing in the list.

Step 3 – Install MySQL 5.7 on Ubuntu 20.04 Linux machine

Having found MySQL 5.7 in our system, we are going to install MySQL 5.7 client, MySQL 5.7 server with the below command:

sudo apt install -f mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7*

Hit the y key to start installation of MySQL 5.7 on Ubuntu 20.04 Linux.

Enter and re-enter root password when prompted

Step 4 – Secure MySQL 5.7 Installation on Ubuntu 20.04

Run the command below to secure MySQL

sudo mysql_secure_installation

Press Enter. When prompted for password, provide the root password set above.

Answer the prompts as below:

Enter current password for root (enter for none): <Enter password>
VALIDATE PASSWORD PLUGIN can be used to test passwords 
and improve security. It checks the strength of password 
and allows the users to set only those passwords which are 
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: Y

There are three levels of password validation policy:

LOW Length >= 8 
MEDIUM Length >= 8, numeric, mixed case, and special characters 
STRONG Length >= 8, numeric, mixed case, special characters and dictionary

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 
Using existing password for root. 
Estimated strength of the password: 25 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : d
Remove anonymous users? [Y/n] Y 
Disallow root login remotely? [Y/n] Y 
Remove test database and access to it? [Y/n] Y 
Reload privilege tables now? [Y/n] Y 
Thanks for using MariaDB!

Step 5 – Check MySQL 5.7 version on Ubuntu 20.04

To confirm the installed version, first, connect to MySQL with the set root password.

mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.35 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Run the below command to display version

Step 6 – Create MySQL User (Optional, testing only)

While still connected to MySQL, run the following commands to create a user:

CREATE USER 'user'@'%' IDENTIFIED BY 'MyStrongPass.';
GRANT ALL PRIVILEGES ON * . * TO 'user'@'%';
FLUSH PRIVILEGES;
exit

Step 7 – Enable MySQL remote access (Optional)

By default, MySQL remote access is disabled. To enable it we need to edit mysqld.cnf file as below:

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

Look for the line bind_address and change as below:

# By default we only accept connections from localhost 
#bind-address = 127.0.0.1 
bind-address = 0.0.0.0

Save the file and restart mysql

sudo systemctl restart mysql

Allow remote connections through the firewall

sudo ufw allow from <remote_IP_address> to any port 3306
sudo ufw enable

To access the database from a remote machine, run the following command:

mysql -u user -h database_server_ip -p

You have successfully installed and tested MySQL 5.7 on Ubuntu 20.04.

Ref: https://www.letscloud.io/community/how-to-install-mysql-57-on-ubuntu-2004

Administrations Configurations (Linux) MySQL MySQLMySQL 5.7UbuntuUbuntu 20

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx openvpn pfsense php Postfix Proxmox RDP Softether SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin Windows 10 XCP-NG zimbra

Topics

Recent Posts

  • CovermyAss February 27, 2026
  • KVM Cloud Capacity Planning Script (Enhanced) February 20, 2026
  • Youtube MP3 Downloader Script using AI February 14, 2026
  • Install Softether VPN and create a Destination NAT (D-NAT) Rule to access the private Client VPN Node on a Debian 12 OS February 14, 2026
  • Deploying Pulse Monitoring for Proxmox Cluster Ecosystem February 13, 2026
  • Technitium DNS Web UI Configuration for Primary-Secondary Name Servers February 12, 2026
  • Technitium DNS with Primary-Slave Installation on Debian February 12, 2026
  • Install Docker and Docker Compose in Debian 12 February 5, 2026
  • Install GUI on Debian 12 using CLI February 4, 2026
  • Configuring Multiple PHP Versions on Virtualmin January 30, 2026

Archives

Top Posts & Pages

  • CovermyAss
©2026 Bots! | WordPress Theme by SuperbThemes