問題描述:
連接Mysql時,當密碼正確時提示1251錯誤:
#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
密碼不正確時,則提示:
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
原因:
由于MySQL 4.1 及其后版本验证协议使用的密码哈希算法与老的客户端不兼容,在PHPMYADMIN里用正确密码登陆也会提示:#1251错误.
解決:打開mysql客戶端,輸入以下兩種方法之一即可
第一種:SET PASSWORD FOR 'dbuser'@"localhost"=OLD_PASSWORD('yourPassword');
第二種:mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')-> WHERE Host = 'some_host' AND User = 'some_user';mysql> FLUSH PRIVILEGES;