From a155350a07379b9795cb06889f70f6b6f18a66b9 Mon Sep 17 00:00:00 2001 From: lcp0578 Date: Sat, 8 Sep 2018 16:42:57 +0800 Subject: [PATCH] update mysql8 authentication --- README.md | 1 + src/MySQL/README.md | 3 ++- src/MySQL/mysql8_authentication_plugin.md | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/MySQL/mysql8_authentication_plugin.md diff --git a/README.md b/README.md index 8f81abb7..2d467a1f 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ - [DROP INDEX](src/MySQL/DROP_INDEX.md) - [Atlas](src/MySQL/Atlas.md) Atlas (MySQL proxy) 使用 - [MySQL 8 windows install](src/MySQL/mysql8_windows_install.md) MySQL8在windows下的安装 + - [MySQL8 authentication plugin](src/MySQL/mysql8_authentication_plugin.md)MySQL8密码验证插件更换后,问题解决办法 4. [composer](src/composer/README.md "composer") - [composer basic](src/composer/basic.md) composer基础使用 - [composer config](src/composer/config.md) composer配置相关 diff --git a/src/MySQL/README.md b/src/MySQL/README.md index 8b8d26fe..b23e189d 100644 --- a/src/MySQL/README.md +++ b/src/MySQL/README.md @@ -16,4 +16,5 @@ - [windows mysql](windows_mysql.md) windows下安装mysql - [DROP INDEX](DROP_INDEX.md) - [Atlas](Atlas.md) Atlas (MySQL proxy) 使用 -- [MySQL 8 windows install](mysql8_windows_install.md) MySQL8在windows下的安装 \ No newline at end of file +- [MySQL 8 windows install](mysql8_windows_install.md) MySQL8在windows下的安装 +- [MySQL8 authentication plugin](mysql8_authentication_plugin.md)MySQL8密码验证插件更换后,问题解决办法 \ No newline at end of file diff --git a/src/MySQL/mysql8_authentication_plugin.md b/src/MySQL/mysql8_authentication_plugin.md new file mode 100644 index 00000000..103d3a6f --- /dev/null +++ b/src/MySQL/mysql8_authentication_plugin.md @@ -0,0 +1,17 @@ +## MySQL8 authentication plugin +- MySQL default authentication-plugin + - MySQL8之前版本,采用:mysql_native_password + - MySQL8 采用:caching_sha2_password +- MySQL客户端提示连接失败解决办法 + - 修改默认配置 + + default-authentication-plugin=mysql_native_password + - 重新设置root密码 + + use mysql; + ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new password'; + FLUSH PRIVILEGES; +- PHP报错:SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client + - 错误原因:由于MySQL 8默认使用了新的密码验证插件:caching_sha2_password,而之前的PHP版本中所带的mysqlnd无法支持这种验证。 + - 升级PHP,查看phpinfo的mysqlnd的Loaded plugins部分,是否包含caching_sha2_password + - 目前开始支持的版本:PHP 7.1.20以上版本和PHP 7.2.8以上版本。 \ No newline at end of file