Install MySQL 8.0 on Ubuntu 16.04 | 17.10 | 18.04

This brief tutorial shows students and new users how to install the latest MySQL 8.0 on Ubuntu 16.04 / 17.10 and 18.04…

Nowdays, everywhere you look you’ll find MariaDB database server being used with many opensource projects… This was not the case few years ago.

Then, MySQL was the probably the only databse server used in majority of the opensource projects… Because of licenses changes made by Oracle, MariaDB was introduced and the opensource community migrated to MariaDB instead…

MySQL is now far behind MariaDB in many opensource project… Many of our LAMP and LEMP tutorials used MariaDB as well.

However, some project still work better with MySQL and have not fully enbraced MariaDB… and for those folks, MySQL should be installed…

To install the latest version MySQL follow steps below:

Step 1 Get MySQL APT Repository

The MySQL package version that comes with Ubuntu default repositories is not the latest version… If you need to install the latest version of MySQL database, you may want to install its repository in Ubuntu..

Go to the link below download the APT repository

The repository package for Ubuntu and others can be downloaded from the link below…

https://dev.mysql.com/downloads/repo/apt/

Visit the download page and look for Ubuntu / Debian (Architecture Independent), DEB Package. The click the Download button to get the repository package…

ubuntu mysql repository

You can also use the command line to download.. changing the version number of the package.

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

Then run the commands below to install

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

When you run the commands above, you should get a config prompt.. just select OK as shown in the image below.

MySQL APT Repo features MySQL Server along with a variety of MySQL  components. You may select the appropriate product to choose the version that you wish to receive.

MySQL 8 on Ubuntu

Step 2: Install MySQL 8.0

Now that the repository is installed, run the commands below to install

sudo apt update
sudo apt install mysql-server mysql-client

That will install the latest version MySQL on your system… During the installation, you should be prompted to create and confirm a MySQL root password.

MySQL 8

Also, you confirm wheather you want to use the new password encryption feature… it’s recommended.

MySQL 8 install ubuntu

After that, MySQL should be installed… you can logon by running the commands

sudo mysql -u root -p

You should see MySQL welcoem screen shown below:

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
owners.

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

That how to install the latest version of MySQL on Ubuntu..

You may also like the post below:

Install Ubuntu 18.04 LTS Server [ Screenshots]

13 Replies to “Install MySQL 8.0 on Ubuntu 16.04 | 17.10 | 18.04

  1. Wow works like a charm. To add if you have 5.7 and upgrading to 8, it will retain your users and schemas/databases. Thanks for sharing.

  2. Thanks ! It helped me a lot…. Also can you pls help me in creating a shortcut for opening mysql instead of the commands…

  3. My installation failed for MySQL 8.0.16-2ubuntu18.04 on Ubuntu 18.04.2 LTS, using 4.4.0-17134-Microsoft kernel, I am installing running Ubuntu under WSL.

    My error : dpkg: error processing package mysql-community-server (–configure):

    Dpkg log detail
    emitting double-array: 100% |###########################################|
    reading /usr/share/mecab/dic/ipadic/matrix.def … 1316×1316
    emitting matrix : 100% |###########################################|

    done!
    update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
    Setting up mysql-community-server (8.0.16-2ubuntu18.04) …
    update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
    dpkg: error processing package mysql-community-server (–configure):
    installed mysql-community-server package post-installation script subprocess returned error exit status 1
    dpkg: dependency problems prevent configuration of mysql-server:
    mysql-server depends on mysql-community-server (= 8.0.16-2ubuntu18.04); however:
    Package mysql-community-server is not configured yet.

    dpkg: error processing package mysql-server (–configure):
    dependency problems – leaving unconfigured
    Processing triggers for libc-bin (2.27-3ubuntu1) …
    No apport report written because the error message indicates its a followup error from a previous failure.
    Errors were encountered while processing:E: Sub-process /usr/bin/dpkg returned an error code (1)

  4. After following your steps till the step
    sudo apt install mysql-server mysql-client
    successfully im getting problem as it is not asking to set password instead its asking me to enter it.
    When i tried entering my ubuntu password its giving as
    ERROR 2002(HY000): can’t connect to local Mysql server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
    Please do help.

Leave a Reply to agguro Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.