Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 缓存\u sha2\u密码mysql错误_Php_Mysql_Mysqli_Codeigniter 3 - Fatal编程技术网

Php 缓存\u sha2\u密码mysql错误

Php 缓存\u sha2\u密码mysql错误,php,mysql,mysqli,codeigniter-3,Php,Mysql,Mysqli,Codeigniter 3,当我升级我的PHP和MySQL版本时,会产生这样的错误 Warning: mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] Warning: mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to t

当我升级我的PHP和MySQL版本时,会产生这样的错误

Warning: mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]
Warning: mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to the client in
我正在使用以下版本:

Codeigniter : 3.1.9 
PHP         : 7.2.6
MySql       : 8.0.11

Thanx…

这是MySql的版本,在8.0版之后,它不支持缓存\u sha2\u密码插件

但是,如果无法更改其版本,您可以尝试将其添加到mysql配置文件中,然后重新启动服务器

[mysqld]
default-authentication-plugin=mysql_native_password
另一项建议是:

如果问题仍然存在,请尝试以管理员身份运行IDE


我在StackOverflow中完成了我在几个答案中看到的所有步骤,但只有在我以管理员身份运行PhpStorm之后,我才能成功登录。

一个可能的解决方案是更改mysql默认用户或mysql根用户的身份验证插件

只需以root用户身份登录mysql控制台(终端/phpmyadmin), 并将密码重置为

ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
为了安全起见,我会以这种方式更改所有现有用户的密码

您可以通过获取现有用户及其字段的列表

use mysql ;

select * from user \G;
我从一开始就这样设置mysql,没有出现过这样的错误

参考:


当我遇到这个问题时,它对我起了作用,请注意加载的配置文件,其中有更多配置文件,可能您更改了错误的配置文件。您应该重新启动mysql服务器,而不是apachei。我在my.cng文件中做了更改。为什么使用不同权限运行IDE会影响代码的执行?嗨,Luis。欢迎来到Stackoverflow。不直接回答问题的输入,如您提出的建议,应作为评论发布。(我知道您可能没有足够的声誉,无法立即对问题发表评论,但这就是问题所在,对不起。)