Loading
0

MySQL 8.0.34对其自带身份验证标记弃用

如题,如果你的MySQL的用户还在使用mysql_native_password(密码插件)的认证方式,那么在MySQL更新到8.0.34后,每次数据库用户以mysql_native_password方式访问MySQL,日志就会输出mysql_native_password已经废弃,即将在未来版本移除,请以caching_sha2_password替代。

日志原文:

Plugin mysql_native_password reported: 'mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead

旧的数据库账户,除了MySQL自带的账户,通过SQL来更新认证模式和密码:

ALTER USER '用户名'@'域' IDENTIFIED WITH caching_sha2_password BY '密码';

必须附带密码(可以用旧密码),因为加密方式不一样。你不改密码直接通过UPDATE改用户认证模式到caching_sha2_password,MySQL会输出日志提示该用户无效,忽略。

Found invalid password for user: '用户名@域'; Ignoring user

而MySQL自身的账户,可以通过以下SQL更新到caching_sha2_password模式:

UPDATE mysql.user SET plugin='caching_sha2_password' 
WHERE user='mysql.session' OR user='mysql.sys' 
OR user='mysql.infoschema';
UPDATE mysql.user SET 
authentication_string=
'$A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED' 
WHERE user='mysql.session' OR user='mysql.sys' OR user='mysql.infoschema';

另外就是binlog_format默认为row,且已经废弃,即将在未来版本移除。

对于PHP来说,使用7.1(7.1.16之前的版本)或者7.2(7.2.4之前的版本),仍需要将MySQL服务器的默认密码插件设置为mysql_native_password,不然无法正常连接到MySQL。

这些版本的PHP建议尽快更新到最新版本8.2.8,或者尽快更新对应版本的新的小版本。

最后编辑于:2023/12/8作者: joycode

我不入地狱,谁入地狱?

评论已关闭