MySQL 4.1+ using old authentication

参考自这里

连接MySQL出现 mysqlnd cannot connect to MySQL 4.1+ using old authentication 错误

打开 /etc/my.cnf 会看到

# Default to using old password format for compatibility with mysql 3.x
old_passwords=1

默认使用 old_passwords 格式, 这是为了兼容 mysql 3.x, 如果没有这个需求, 那就用新的密码方式吧!
具体操作步骤如下:

1、编辑my.cnf注释掉一下行:
   old_passwords = 1

2、重启MySQL
   service mysqld restart
   /etc/inint.d/mysqld restart

3、检查是否有16位的密码
   SELECT user, Length(`Password`) FROM `mysql`.`user`;

4、如果有,把对应的用户名密码用以下SQL更新
   UPDATE mysql.user SET Password = PASSWORD('password') WHERE user = 'username';

5、更新后要刷新
   FLUSH PRIVILEGES;
This entry was posted in Linux, Mysql and tagged . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>