Install MySQL 8.0 for Ubuntu 16.04

Time:2021-7-26

Install via path

The versions installed through apt are the latest versions. After installation in this way, the startup and self startup have been configured, and the environment variables on the command line do not need to be configured manually.

mysql-apt-config.debDownload address

Install MySQL 8.0 for Ubuntu 16.04

  • 1. Unpacking
$ sudo dpkg -i mysql-apt-config_0.8.14-1_all.deb

Install MySQL 8.0 for Ubuntu 16.04

Install MySQL 8.0 for Ubuntu 16.04

  • 2. Update system installation source

After execution, execute

$ sudo apt update
  • 3. Install MySQL service
$ sudo apt install mysql-server

Install MySQL 8.0 for Ubuntu 16.04

MySQL 8.0 adopts a new encryption method. It must be noted that it is this encryption method that makes the set root password unable to log in to MySQL, because there may be a problem with the terminal and does not support this new encryption method. Fortunately, the interface allows us to choose to use the encryption method of the old version 5. X, so we resolutely choose to use the encryption method of 5. X.

Install MySQL 8.0 for Ubuntu 16.04

To modify the character set, first find the installation location of MySQL. You can use the following command:
$ whereis mysql

Install MySQL 8.0 for Ubuntu 16.04

Install MySQL 8.0 for Ubuntu 16.04

  • 5. Restart MySQL service
$ service mysql restart
  • 6. Login
$ mysql -uroot -p

Install MySQL 8.0 for Ubuntu 16.04

  • 7. Modify client character set
In order to display Chinese characters normally, the client character encoding needs to be modified. After successful login, enter charset utf8 in the console window.
  • test

Enter status on the console to display the following information

Install MySQL 8.0 for Ubuntu 16.04

However, using Navicat remote connection discovery cannot connect

Install MySQL 8.0 for Ubuntu 16.04

Configure MySQL remote connection

$ show databases;

$ use mysql

$ select host from user wehre user='root';

$ update user set host = '%' where user = 'root';

$ flush privileges;

Install MySQL 8.0 for Ubuntu 16.04

This work adoptsCC agreement, reprint must indicate the author and the link to this article