MySQL 8 on Ubuntu 18.04: Legacy Installation Guide
Legacy Ubuntu 18.04 guide. Standard support ended in June 2023, and Oracle’s Bionic repository still lists MySQL 8.0.33.
On this page
This page documents the former MySQL installation procedure for Ubuntu 18.04 (Bionic). Keep it only for reference when diagnosing existing legacy hosts.
Repository status: Do not use the Bionic commands below for a new or production server. Oracle’s Bionic MySQL 8.0 package index currently lists MySQL 8.0.33-1ubuntu18.04, below the final MySQL 8.0 release, 8.0.46. Ubuntu 18.04 standard security maintenance ended in June 2023; Ubuntu Pro ESM is listed through April 2028. For an existing MySQL 8.0 instance, follow the MySQL 8.0 to 8.4 upgrade guide and verify that the target operating system is supported. For a new server, see our MySQL 9.7 LTS guide for Ubuntu 26.04. Check OS coverage in Ubuntu’s release list and MySQL lifecycle details in the MySQL 8.0 release notes.
Prerequisites
Before you install MySQL, you need to have the following prerequisites:
- Ubuntu 18.04 server with a non-root user with sudo privileges
- An internet connection
Step 1 - Update Package Repository
First, update your Ubuntu package repository to latest with:
sudo apt update
Step 2 - Add the MySQL APT Repository
Install the current MySQL APT repository configuration package. As of September 2026, the package is 0.8.40-1:
sudo apt install -y wget
wget https://dev.mysql.com/get/mysql-apt-config_0.8.40-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.40-1_all.deb
In the configuration dialog, select MySQL Server & Cluster, then choose the mysql-8.0 series. Refresh APT’s package information:
sudo apt update
Step 3 - Install MySQL Server
Now install MySQL server:
sudo apt update
sudo apt install mysql-server
This will install MySQL 8.0.
Step 4 - Start MySQL Service
Once installed, the MySQL service will start automatically. You can check it with:
sudo systemctl status mysql
Step 5 - Secure MySQL Installation
It’s recommended that you run the mysql_secure_installation script to improve MySQL security:
sudo mysql_secure_installation
This will set the root password, remove anonymous user accounts, disable root logins outside localhost, etc.
Step 6 - Create a Dedicated MySQL User
Create an application user instead of using the root account. First open a local administrator session:
sudo mysql
At the MySQL prompt, create the sample database and an application user with access limited to it:
CREATE DATABASE IF NOT EXISTS mytestdb;
-- MySQL 8.0.18+ returns a generated password; save it securely for the connection test.
CREATE USER 'myuser'@'localhost' IDENTIFIED BY RANDOM PASSWORD;
-- CREATE is included for the sample table; use a separate migration account for schema changes in production.
GRANT CREATE, SELECT, INSERT, UPDATE, DELETE ON mytestdb.* TO 'myuser'@'localhost';
Choose the account name you need, then save the generated password shown by MySQL in a secure secret store; do not reuse it or commit it to application code.
Step 7 - Test MySQL
To test if MySQL is working properly, connect to the mysql server with the new user created:
mysql --user=myuser --password mytestdb
Enter the password when prompted. Then you’ll enter into the MySQL shell.
Run a simple command to test connectivity:
SHOW DATABASES;
This will show the available databases.
Step 8 - Create a Sample Table
The administrator created mytestdb in the previous step. Create a sample table in it:
USE mytestdb;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
email VARCHAR(50)
);
The server is installed. Because MySQL 8.0 reached end of life in April 2026, keep this procedure for existing legacy systems only; do not choose this series for a new production deployment.
Conclusion
This guide documents the MySQL 8.0 package still available for Ubuntu 18.04 systems under Ubuntu Pro ESM. For a new installation, use a supported operating-system release and a maintained LTS series; see MySQL 9.7 LTS on Ubuntu 26.04.
If you want to learn more about MySQL, please use our MySQL tutorials and MySQL Reference.