MySQL 8.0上的phpMyAdmin [英] phpMyAdmin on MySQL 8.0

查看:395
本文介绍了MySQL 8.0上的phpMyAdmin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新
较新版本的phpMyAdmin解决了此问题.我已经使用phpMyAdmin 5.0.1成功测试了

UPDATE
Newer versions of phpMyAdmin solved this issue. I've successfully tested with phpMyAdmin 5.0.1

我已经安装了MySQL 8.0服务器和phpMyAdmin,但是当我尝试从浏览器访问它时,会发生以下错误:

I have installed the MySQL 8.0 server and phpMyAdmin, but when I try to access it from the browser the following errors occur:

#2054 - The server requested authentication method unknown to the client
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client

我想它一定与实现的强密码和MySQL版本相对新鲜有关.

I imagine it must have something to do with the strong passwords implemented and the relative freshness of the MySQL release.

但是我对最高级的驱动程序和连接配置一无所知.

But I know nothing of the most advanced driver and connection configuration.

有人遇到过同样的问题并解决了吗? :D

Has someone faced the same problem and solved it? :D

推荐答案

使用 root 用户登录MySQL控制台:

Log in to MySQL console with root user:

root@9532f0da1a2a:/# mysql -u root -pPASSWORD

并使用其中的密码更改身份验证插件:

and change the Authentication Plugin with the password there:

mysql> ALTER USER root IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
Query OK, 0 rows affected (0.08 sec)

您可以在MySQL 8.0参考手册上阅读有关首选身份验证插件的更多信息

https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password

它在 docker 标准化环境中完美运行:

It is working perfectly in a dockerized environment:

docker run --name mysql -e MYSQL_ROOT_PASSWORD=PASSWORD -p 3306:3306 -d mysql:latest

docker exec -it mysql bash

mysql -u root -pPASSWORD

ALTER USER root IDENTIFIED WITH mysql_native_password BY 'PASSWORD';

exit

exit

docker run --name phpmyadmin -d --link mysql:db -p 8080:80 phpmyadmin/phpmyadmin:latest

因此,您现在可以使用根/密码登录 http://localhost:8080 上的phpMyAdmin

So you can now log in to phpMyAdmin on http://localhost:8080 with root / PASSWORD

mysql/mysql-server

如果您使用的是 mysql/mysql-服务器 docker映像

If you are using mysql/mysql-server docker image

但是请记住,它只是开发环境中的快速而肮脏的"解决方案.更改 MySQL首选身份验证插件.

docker run --name mysql -e MYSQL_ROOT_PASSWORD=PASSWORD -e MYSQL_ROOT_HOST=% -p 3306:3306 -d mysql/mysql-server:latest
docker exec -it mysql mysql -u root -pPASSWORD -e "ALTER USER root IDENTIFIED WITH mysql_native_password BY 'PASSWORD';"
docker run --name phpmyadmin -d --link mysql:db -p 8080:80 phpmyadmin/phpmyadmin:latest

解决方案已于2018年10月4日更新

通过取消注释/etc/my.cnf

使用后果自负

docker run --name mysql -e MYSQL_ROOT_PASSWORD=PASSWORD -e MYSQL_ROOT_HOST=% -p 3306:3306 -d mysql/mysql-server:latest
docker exec -it mysql sed -i -e 's/# default-authentication-plugin=mysql_native_password/default-authentication-plugin=mysql_native_password/g' /etc/my.cnf
docker stop mysql; docker start mysql
docker run --name phpmyadmin -d --link mysql:db -p 8080:80 phpmyadmin/phpmyadmin:latest

更新的解决方法于2019年1月30日

docker run --name mysql -e MYSQL_ROOT_PASSWORD=PASSWORD -e MYSQL_ROOT_HOST=% -p 3306:3306 -d mysql/mysql-server:latest
docker exec -it mysql sed -i -e 's/# default-authentication-plugin=mysql_native_password/default-authentication-plugin=mysql_native_password/g' /etc/my.cnf
docker exec -it mysql mysql -u root -pPASSWORD -e "ALTER USER root IDENTIFIED WITH mysql_native_password BY 'PASSWORD';"
docker stop mysql; docker start mysql
docker run --name phpmyadmin -d --link mysql:db -p 8080:80 phpmyadmin/phpmyadmin:latest

default_authentication_plugin

这篇关于MySQL 8.0上的phpMyAdmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆