LoginSignup
3
1

More than 5 years have passed since last update.

MySQL 8 - Public Key Retrieval is not allowed

Last updated at Posted at 2018-07-04

Problem

Start from MySQL 8, the authentication plugin is changed to "caching_sha2_password".

Therefore, phpMyAdmin or other client tools will get "Public Key Retrieval is not allowed" problem.

mysql01.png

Solution

We changed the authentication plugin to "mysql_native_password".

If you use docker. You need do this first.
$ sudo docker exec -it docker_run_name bash
Example: $ sudo docker exec -it mysql bash

$ mysql -u root -p

mysql> use mysql

mysql> select host, user from user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| %         | root             |
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
+-----------+------------------+
5 rows in set (0.00 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Your New Password';
Query OK, 0 rows affected (0.08 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

Test

mysql02.png

3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1