问题描述
由于在Node的MysqL库尚未实现caching_sha2_password
的情况下,我无法在本地主机上连接MysqL 8.0.21-0ubuntu0.20.04.4,因此我用以下查询修改了用户,以切换到旧版本MysqL_native_password
算法。
ALTER USER 'test'@'localhost' IDENTIFIED WITH MysqL_native_password BY 'mypass';
然后,我想远程连接,所以我创建了一个以test_remote
标识的新MysqL_native_password
用户,如用户列表所示。
+------------------+-----------------------+------------------------------------------------------------------------+
| User | plugin | authentication_string |
+------------------+-----------------------+------------------------------------------------------------------------+
| test | MysqL_native_password | *88F9.................................... |
| test_remote | MysqL_native_password | *88F9.................................... |
+------------------+-----------------------+------------------------------------------------------------------------+
问题是我可以在localhost中正确连接,但是远程连接仍在请求caching_sha2_password
。具体来说,我尝试使用以下代码连接PHP v7.1.7:
<?PHP
$ms = new MysqLi("xxx.xxx.xxx.xxx","test_remote","mypass","mydb);
if($ms->connect_error) {
echo $ms->connect_error;
}
这将导致:
Warning: MysqLi::__construct(): The server requested authentication method unkNown to the client [caching_sha2_password] in C:\xampp\htdocs\thrive-web\test.PHP on line 2
Warning: MysqLi::__construct(): (HY000/2054): The server requested authentication method unkNown to the client in C:\xampp\htdocs\thrive-web\test.PHP on line 2
The server requested authentication method unkNown to the client
我在寻找其他问题和资源,但他们都说要更改密码插件,而我已经这样做了,所以目前我一无所知。
我做错什么了吗?谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)