程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> 關於MYSQL數據庫 >> mysql_connect(): Connection using old (pre-4.1.1) authentication protocol refused

mysql_connect(): Connection using old (pre-4.1.1) authentication protocol refused

編輯:關於MYSQL數據庫

做了一下mysql升級,開發機上mysql升級到5.6版本,結果連接一些低版本的mysql服務器報出如下異常:
Warning: mysql_connect(): Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)

異常原因在於服務器端的密碼管理協議陳舊,使用的是舊有的用戶密碼格式存儲;但是客戶端升級之後采用了新的密碼格式。mysql5.6版本遇到這種不一致的情況就會拒絕連接。

詳見mysql手冊“Server Command Options”一節中“--secure-auth"選項的說明:http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_secure-auth


解決方法有如下三種:

1、服務器端升級啟用secure_auth選項;

2、客戶端連接時off掉secure_auth,即連接時加上--secure_auth=off,如:mysql -p10.51.1.11 -P3308 -uroot --secure_auth=off

3、找到對應的mysql用戶把密碼改為新的加密方式,PASSWORD(‘your password'),如:
復制代碼 代碼如下:SET PASSWORD FOR root=PASSWORD('123456');

對於方法二,使用在程序做相應mysql配置即可,以php為例,在php.ini中設置secure_auth=off

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved