首页 > php教程 > PHP开发 > 正文

PHP5连接Mysql5的认证协议问题

高洛峰
发布: 2016-12-02 14:00:21
原创
1664人浏览过

mysql 4.1以后, 采用了一种新的用户认证协议, 对于老的客户端会出现不支持认证协议的错误, 以下是官方网站的解决方法? 

1upgrade all client programs to use a 4.1.1 or newer client library. 

更新客户端库,这需要更新php的扩展库,对于老的api php已经不提供了这样的扩展库了 

2when connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password. 

使用以前建立的账号连接,对于在新的认证协议下建立的账户就不行了 

3reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. this can be done using the set password statement and the old_password() function: mysql> set password for 

-> 'some_user'@'some_host' = old_password('newpwd'); 

alternatively, use update and flush privileges: mysql> update mysql.user set password = old_password('newpwd') -> where host = 'some_host' and user = 'some_user'; 

mysql> flush privileges; 

substitute the password you want to use for ``newpwd'' in the preceding examples. mysql cannot tell you what the original password was, so you'll need to pick a new one. 

这是一个不错的办法,新建立的账号采用老式的加密协议 

4tell the server to use the older password hashing algorithm: 

start mysqld with the --old-passwords option. 

这样新认证协议的优点就没法使用了 

5assign an old-format password to each account that has had its password updated to the longer 4.1 format. you can identify these accounts with the following query: mysql> select host, user, password from mysql.user 

-> where length(password) > 16; 

for each account record displayed by the query, use the host and user values and assign a password using the old_password() function and either set password or update, as described earlier. 

恢复已经升级了口令到老样式。 

PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号