这实际上是对先前答案的注释,但是太大而无法放入StackExchange注释中。
我也正遭受这个问题的困扰。因此,我创建了一个具有新样式哈希的新用户,现在可以毫无困难地使用该新用户。这是我所做的:
[172.16.2.222:mysql Thu Nov 7 16:16:25 2013]> use mysql;
Database changed
[172.16.2.222:mysql Thu Nov 7 16:22:23 2013]> describe user;
describe user;
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+-----------------------------------+------+-----+---------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(16) | NO | PRI | | |
| Password | char(41) | NO | | | |
我很高兴看到我们的“密码”列已经足够容纳新样式的哈希。(如果宽度少于41个字符,我可能没有勇气将其扩大:-)
[172.16.2.222:mysql Thu Nov 7 16:13:10 2013]> show variables like '%pass%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| old_passwords | ON |
| report_password | |
+-----------------+-------+
2 rows in set (0.06 sec)
old_passwords
存在ON
显然是问题所在,所以我暂时更改了它:
[172.16.2.222:mysql Thu Nov 7 16:13:59 2013]> set session old_passwords = 'OFF';
Query OK, 0 rows affected (0.05 sec)
[172.16.2.222:mysql Thu Nov 7 16:14:12 2013]> show variables like '%pass%';
show variables like '%pass%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| old_passwords | OFF |
| report_password | |
+-----------------+-------+
2 rows in set (0.06 sec)
然后,我创建了一个新用户:
[172.16.2.222:mysql Thu Nov 7 16:14:16 2013]> create user 'erich' IDENTIFIED BY 'SEKRIT PASSWORD';
...并查看了新的哈希值:
[172.16.2.222:mysql Thu Nov 7 16:14:26 2013]> select * from user order by User;
+-----------+--------------+-------------------------------------------+--------
| Host | User | Password | Select_
+-----------+--------------+-------------------------------------------+--------
| localhost | someguy | 3d9505dd323e53f1 | Y
| % | someotherguy | 79b3df3b004bb855 | Y
| % | erich | *D2589EF6B59146801234567897BB190123456789 | N
| % | anotheroldguy| 60577e0d77b9212b | Y
注意我的哈希值比其他哈希值大!
为了保持整洁,我old_passwords
回到OFF
。这可能毫无意义,因为我不知道为什么有人会使用旧密码创建新用户,但谁知道。
无论如何:这为我解决了。