phpMyAdmin配置后总出现客户端不支持认证协议错误的原因

许久不在这里写日志了。因为申请了个人主页,使用phpMyAdmin维护远程MySQL的,所以,自己在本地也搭建一个环境,但无论如何都不能成功,总会出现客户端不支持认证协议的提示,所以找到MySQL的文档研究了一下,记录下来。

MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients. If you upgrade the server from 4.0, attempts to connect to it with an older client may fail with the following message:
MySQL 4.1及以上版本的验证协议使用了旧版本的客户端就不兼容的口令hashing机制。如果你由4.0版本升级而来,尝试用旧客户端连接就会收到以下失败信息:

shell> mysql
Client does not support authentication protocol requested
by server; consider upgrading MySQL client

To solve this problem, you should use one of the following approaches:
要解决这个问题,应采取以下步骤之一:
Upgrade all client programs to use a 4.1.1 or newer client library.
升级所有客户端程序,使之采用4.1.1或更新版本的客户端库。
When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.
采用4.1版本前的客户端时,使用一个仍旧4.1前版本密码格式的帐号连接服务器。
Reset 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:
为需要使用4.1版本前客户端程序的用户重新设置密码格式为4.1前格式。可以采用SET PASSWORD语句及OLD_PASSWORD()函数达到此目的:
mysql> SET PASSWORD FOR
    -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

Alternatively, use UPDATE and FLUSH PRIVILEGES:
另外,也可是使用UPDATE和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.
上述示例中将口令替换为新口令“newpwd”,MySQL不能告诉你原有密码是什么,所以,你需要提供一个新的口令来替换。
Tell the server to use the older password hashing algorithm:
让服务器应用旧的口令hashing机制:
Start mysqld with the --old-passwords option.
启动mysqld时加--old-passwords选项。
Assign 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:
为升级至4.1版本密码格式(较长)的帐号设置旧格式密码。你可以用以下语句找出这些帐号:
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.
查询结果中每个帐号,通过对应的Host及User值,用OLD_PASSWORD()函数或前面提到的SET PASSWORD或UPDATE来设置旧格式密码。
Note: In PHP, the standard mysql extension does not support the new authentication protocol in MySQL 4.1.1 and higher. This is true regardless of the PHP version being used. If you wish to use the mysql extension with MySQL 4.1 or newer, you will need to follow one of the options discussed above for configuring MySQL to work with old clients.
注意:PHP中,标准mysql扩展不支持MySQL 4.1.1及以上版本中新的验证协议。当前使用的PHP版本中的确是被忽视了的。如果你想使用MySQL4.1及以上的mysql扩展,就需要应用以上所讨论的方法配置MySql,使之正常工作。
The mysqli extension (stands for "MySQL, Improved"; new in PHP 5) is compatible with the improved password hashing employed in MySQL 4.1 and higher, and no special configuration of MySQL need be done to use this newer MySQL client library for PHP. For more information about the mysqli extension, see http://php.net/mysqli.
mysqli扩展("MySQL, Improved"标准; PHP5中新增)支持MySQL4.1及以上版本的口令hashing,因此,使用该新MySQL客户端库不需要再作什么特殊配置。更多关于mysqli扩展的信息,请见http://php.net/mysqli
It may also be possible to compile the older mysql extension against the new MySQL client library. This is beyond the scope of this Manual; consult the PHP documentation for more information. You also be able to obtain assistance with these issues in our MySQL with PHP forum.
与新的Mysql客户端库对应的是,编译旧mysql扩展(以支持新的口令hashing)也是可能的。但该讨论超出了本文范畴,可参考php文档以获取更多信息。
For additional background on password hashing and authentication, see Section 5.7.9, “Password Hashing as of MySQL 4.1”.
更多口令hashing及认证的背景知识,请参照5.7.9章节,“Password Hashing as of MySQL 4.1”。
 

你可能感兴趣的:(Web开发)