Home > Database > Mysql Tutorial > body text

解决php连新版本mysql数据库错误_MySQL

WBOY
Release: 2016-06-01 13:55:41
Original
745 people have browsed it

在更新到 4.1.1x 版本的 MySQL 后,发现需要使用 MySQLi 扩展方能正常使用数据库,否则会出现 1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client 的提示,这个很纳闷,我没有研究具体的问题,只是切换到 MySQLi 扩展,

其实在给 root 加上密码前还是可以使用 MySQL 扩展的,可是给 root 加上密码后就出现了上述客户端版本太低的提示。

  目前已知解决方法:

先用root登录MYSQL服务器,执行

mysql>set password for user1@"localhost"=old_password('yourPassword');

  原因是因为你使用的mysql服务器版本中使用了新的密码验证机制,这需要客户端的版本要在4.0以上,原来的密码函数被改为old_password();,这样使用password()生成的密码在旧的版本上的客户端就不好使了,而PHP中的MYSQL客户端都是3.23的(当然,mysqli的扩展除外),问题就在这了。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!