php鏈接mysql mysqlnd cannot connect to MySQL 4.1+ us

密碼字節數的問題,設置 old_passwords=0 便可解決; mysql

在 mysql的my.ini文件中將old_passwords=1 修改成 0; sql

或者 set old_passwords =0; .net

1、修改之前的: get

mysql> SELECT user, Length(`Password`) FROM `mysql`.`user`; 
+------+--------------------+
| user | Length(`Password`) |
+------+--------------------+
| root |                 16 |
| root |                  0 |
|      |                  0 |
| test |                 16 |
| test |                 16 |
+------+--------------------+
5 rows in set

2、修改 old_passwords; class

mysql> set old_passwords=0;
Query OK, 0 rows affected

3、修改用戶: test

mysql> UPDATE mysql.user SET Password = PASSWORD( 'snow @wolf ') WHERE user = 'root
';
Query OK, 2 rows affected
Rows matched: 2  Changed: 2  Warnings: 0
Query OK, 0 rows affected

4、查看: 密碼

SELECT user, Length(`Password`) FROM `mysql`.`user`; 
+------+--------------------+
| user | Length(`Password`) |
+------+--------------------+
| root |                 41 |
| root |                 41 |
|      |                  0 |
| test |                 16 |
| test |                 16 |
+------+--------------------+
5 rows in set

 

能夠看到已經更新成功了,將其餘用戶都更新了便可。 word

相關文章
相關標籤/搜索