In this guide, we will cover how to install MySQL 8.0 on Ubuntu 18.04 and 16.04 LTS Server. If you have an old version of MySQL Server (e.g 5.7), you may need to do in-place upgrade or dump all data, upgrade packages and re-import all database data.

Before you can download MySQL v8.0 to your Ubuntu 18.04 or 16.04 Server, you need to add official MySQL Dev apt repository. Run below command:

$ sudo apt-get install wget
$ wget
$ sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb 
Selecting previously unselected package mysql-apt-config.
(Reading database ... 127849 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.8.10-1_all.deb ...
Unpacking mysql-apt-config (0.8.10-1) ...
Setting up mysql-apt-config (0.8.10-1) ...
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)

Select <OK>  and press <Enter> key to confirm version installation.

Once the repo has been added, update apt index and install mysql-server:

$ sudo apt-get update
$ sudo apt-get install mysql-server

When asked for root password, provide the password and confirm it to set.

Confirm installed version of MySQL server:

[email protected]:~# apt policy mysql-server
Installed: 8.0.11-1ubuntu18.04
Candidate: 8.0.11-1ubuntu18.04
Version table:
*** 8.0.11-1ubuntu18.04 500
500 bionic/mysql-8.0 amd64 Packages
100 /var/lib/dpkg/status
5.7.22-0ubuntu18.04.1 500
500 bionic-updates/main amd64 Packages
500 bionic-security/main amd64 Packages
5.7.21-1ubuntu1 500
500 bionic/main amd64 Packages

From the output, you can see that the version installed is 8.0.11. 

You can start the application if stopped using:

$ sudo systemctl start mysql

Check status using:

# systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; masked; vendor preset: enabled)
Active: active (running) since Mon 2018-06-25 07:39:15 UTC; 3min 50s ago
Docs: man:mysqld(8)
Process: 28930 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 28982 (mysqld)
Tasks: 36 (limit: 1152)
CGroup: /system.slice/mysql.service
└─28982 /usr/sbin/mysqld

Jun 25 07:39:14 systemd[1]: Starting MySQL Community Server...
Jun 25 07:39:15 systemd[1]: Started MySQL Community Server.

Test MySQL 8.0 Database Functionality

You can test if the database server is working fine by creating a test database:

[email protected]:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.11 MySQL Community Server - GPL

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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

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

mysql> create database test_db;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test_db            |
5 rows in set (0.01 sec)
mysql> exit

Install Desktop Database Management Tool

If working with MySQL command line is not your thing, then consider installing a Database Tool to help you. Check out our guide below:

Install and Configure DBeaver on Ubuntu 18.04 / Ubuntu 16.04 / Debian 9

You can also see below related Articles: