This article describes how to install MySQL 8.0.11 on the command line of Ubuntu 18.04, Ubuntu 16.04 Server. If you want to install 8.0.14, you can also use the method mentioned in this article.
How to install MySQL 8.0.11 using commands
Please read the official MySQL 8.1.0 release, which is 2 times faster than MySQL 5.7.
1. Before downloading MySQL v8.0 to Ubuntu 18.04 or Ubuntu 16.04 Server, you need to add the official MySQL Dev apt repository, please run the following command:
$ sudo apt-get install wget
$ wget https://repo.mysql.com//mysql-apt-config_0.8.10-1_all.deb
$ 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)
OK
2. Select <OK> and press <Enter> to confirm the version installation.
3. Once the repo is added, update the apt index and install mysql-server:
$ sudo apt-get update
$ sudo apt-get install mysql-server
4. When asked for the root password, please provide the password and confirm its settings:
5. Confirm the installed MySQL server version and run the following command:
root @ node-01: ~ # apt policy mysql-server
The following information is returned:
mysql-server:
Installed: 8.0.11-1ubuntu18.04
Candidate: 8.0.11-1ubuntu18.04
Version table:
*** 8.0.11-1ubuntu18.04 500
500 http://repo.mysql.com/apt/ubuntu bionic / mysql-8.0 amd64 Packages
100 / var / lib / dpkg / status
5.7.22-0ubuntu18.04.1 500
500 http://mirrors.digitalocean.com/ubuntu bionic-updates / main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security / main amd64 Packages
5.7.21-1ubuntu1 500
500 http://mirrors.digitalocean.com/ubuntu bionic / main amd64 Packages
From the information in the output, the version you installed is 8.0.11, and it has been successful.
6. If you stop using it, you can start the application:
$ sudo systemctl start mysql
7. Check status:
# systemctl status mysql
8. Run the mysql -u root -p command to test whether the MySQL 8.0.11 database is normal.