1. Home
  2. Linux
  3. Ubuntu
  4. How to Install MySQL 8.0 in Ubuntu 18.04

How to Install MySQL 8.0 in Ubuntu 18.04

How to Install MySQL 8.0 in Ubuntu 18.04
How to Install MySQL 8.0 in Ubuntu 18.04

Hi, Want to learn Install MySQL 8.0 in Ubuntu! Lets start it and have detailed review. MySQL community server is a free, open-source, popular, and cross-platform database management system. It supports both SQL and NoSQL and has a pluggable storage engine architecture.
Additionally, it also comes with multiple database connectors for different programming languages, allowing you to develop applications using any of the well-known languages, and many other features.


MySQL has a lot of use cases under document storage, cloud, high availability systems, IoT (Internet of Things), Hadoop, big data, data warehousing, LAMP, or LEMP stack for supporting high-volume website/apps and more.
In this tutorial, we will teach you how to do a fresh installation of the MySQL 8.0 database system on Ubuntu 18.04 Bionic Beaver. Before we go into the actual installation steps, let’s have a look at the features MySQL 8.0 offers.

New Features in MySQL 8.0:

What’s New in MySQL 8.0:

  • The database now incorporates a transactional data dictionary.
  • Comes with Atomic DDL statement support.
  • Enhanced security and account management.
  • Improvements to resource management.
  • Several InnoDB enhancements.
  • New type of backup lock.
  • Default character set has changed to utf8mb4 from latin1.
  • A couple of JSON enhancements.
  • Comes with regular expression support using International Components for Unicode (ICU).
  • New error logging which now uses the MySQL component architecture.
  • Enhancements to MySQL replication.
  • Supports common table expressions (both non-recursive and recursive).
  • Has an enhanced optimizer.
  • Additional window functions and more.


Step 1: Add MySQL Apt Repository

Luckily, there is an APT repository for installing the MySQL server, client, and other components. You have to append this MySQL repository to your system’s package source list, and you can start by downloading the repository package using the wget tool from the command line.

wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb

Then, we will install the MySQL repository package using the following dpkg command:

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

Keep in mind that in the package installation process, you will be asked to choose the MySQL server version and a couple of other components, including cluster, shared client ibraries, or the MySQL workbench that you would like to configure for installation.
The MySQL server version mysql-8.0 will be auto-selected, then you can scroll down to the last option, Ok, and click [Enter] to finish the configuration and installation of the release package.

Step 2: Install MySQL Server in Ubuntu 18.04

Next, we will download the latest package information from all configured repositories, including the recently added MySQL repository.

sudo apt update

Now we will run the command below to install packages for the MySQL community server, client, and database common files.

sudo apt-get install mysql-server

Through the installation process, you will be prompted to enter a password for the root user for your MySQL server, re-enter the password to verify it, and press [Enter].
Now, the MySQL server authentication plugin configuration message will appear; read through it and then use the right arrow to select OK and press [Enter] to proceed.
Then, you will be prompted to select the default authentication plugin to use, after which you should use the right arrow to choose Ok and press [Enter] to finish the package configuration.

Step 3: Secure MySQL Server Installation

By default, the MySQL installation is unsecure. To secure it, execute the security script, which should come with the binary package. You will be prompted to enter the root password that you set during the installation process. Also select whether to use the VALIDATE PASSWORD plugin or not.
You should be able to change the root password that you set before (like we have done in this example). Then, enter yes/y to the following security questions:

  • Remove anonymous users? (Press y|Y for Yes, any other key for No): y
  • Disallow root login remotely? (Press y|Y for Yes, any other key for No): y
  • Remove test database and access to it? (Press y|Y for Yes, any other key for No): y
  • Reload privilege tables now? (Press y|Y for Yes, any other key for No): y

You can launch the script by issuing the command below:

sudo mysql_secure_installation

Step 4: Managing MySQL Server via Systemd

For Ubuntu, once you install a package, its server is normally started automatically after the package is configured. You may check if the MySQL server is up and running using the command below:

sudo systemctl status mysql

If for some reason it doesn’t automatically start, just use the following commands to start and enable it to start at system boot time, as follows:

sudo systemctl status mysql
sudo systemctl enable mysql

Step 5: Install Extra MySQL Products and Components
In addition, you may install extra MySQL components that you feel are required to work with the server, including mysql-workbench-community, libmysqlclient18, and a few others.

sudo apt-get update
sudo apt-get install mysql-workbench-community libmysqlclient18

Lastly, to access the MySQL shell, issue the following command:

sudo mysql -u root -p

Final Thoughts

That’s It! In this article, we have explained how to install MySQL 8.0 in Ubuntu 18.04 Bionic Beaver. If you have any questions or thoughts to share, use the comments section.
Also, here are a few hand-picked guides that must read next:

  1. How to configure remote and secure connections for MySQL on Ubuntu 16.04
  2. How to Check MySQL Database Size


Updated on December 23, 2018

Was this article helpful?

Related Articles

Leave a Comment

[apsl-login-lite login_text='Please login with a social account']