MySQL不允许用户登录:错误1524 [英] MySQL Won't let User Login: Error 1524
问题描述
Server version: 5.7.10 MySQL Community Server (GPL)
在MySQL中,我有一个用户芒果.当我创建它时,用户可以完美地工作.但是,重新启动计算机后,尝试登录芒果会产生以下输出:
In MySQL, I have a user mangos. The user worked perfectly when I created it. After rebooting my computer, though, attempting to login to mangos yielded this output:
$ mysql -u mangos -p
Enter password:
ERROR 1524 (HY000): Plugin '*some_random_long_hash_I_cannot_remember' is not loaded
$
这让我想起了密码哈希,因此在调查mysql.user之后,我发现mangos没有密码! 我更新了密码:
It kind of reminded me of a password hash, so after investigating mysql.user, I found that mangos had no password! I updated the password:
SET PASSWORD FOR 'mangos'@'127.0.0.1' = PASSWORD('mangos');
FLUSH PRIVILEGES;
现在,我得到了:
ERROR 1524 (HY000): Plugin '*3FBBDB84EA2B2A0EA599948396AD622B7FF68183' is not loaded
3FBBDB84EA2B2A0EA599948396AD622B7FF68183
是与mysql.user的password列中显示的mangos相同的数字,并且与原始数字不同.我仍然无法登录.
3FBBDB84EA2B2A0EA599948396AD622B7FF68183
is the same number shown in the password column of mysql.user for mangos, and is a different number than originally. I still can't log in.
如何使MySQL正确识别密码?这甚至是问题所在吗?
How do I make MySQL recognize a password properly? Is that even the issue here?
mysql> SELECT * FROM mysql.user WHERE user = 'mangos' \G
*************************** 1. row ***************************
Host: localhost
User: mangos
Password: *3FBBDB84EA2B2A0EA599948396AD622B7FF68183
Select_priv: N
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: N
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
Show_db_priv: N
Super_priv: N
Create_tmp_table_priv: N
Lock_tables_priv: N
Execute_priv: N
Repl_slave_priv: N
Repl_client_priv: N
Create_view_priv: N
Show_view_priv: N
Create_routine_priv: N
Alter_routine_priv: N
Create_user_priv: N
Event_priv: N
Trigger_priv: N
Create_tablespace_priv: N
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: *3FBBDB84EA2B2A0EA599948396AD622B7FF68183
authentication_string: NULL
password_expired: N
推荐答案
看来您的用户表已损坏.您提到的重启可能触发了MySQL升级,并且mysql_upgrade
脚本未运行.这应该可以解决这种情况:
It appears your user table is corrupted. Likely the reboot you mentioned triggered an upgrade to MySQL and the mysql_upgrade
script was not run. This should resolve the situation:
mysql_upgrade -u root -ppassword --skip-grant-tables
mysql -u root -ppassword -e "UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'mangos'; FLUSH PRIVILEGES"
来源: http://kb .odin.com/en/126676
为mysql_upgrade
提供--force
选项将重新应用升级脚本,即使升级已经完成.如果要从备份中进行部分还原,则可能需要这样做.
Providing the --force
option to mysql_upgrade
will re-apply the upgrade scripts even if an upgrade has already been done. This may be needed in case of partial restoration from backup.
还值得一提的是, MariaDB 10.2.0 并转发:
Also worth mentioning, the command to change a user password has changed in MySQL 5.7.6 / MariaDB 10.2.0 and forward:
ALTER USER mangos IDENTIFIED BY 'mangos';
这是设置密码的首选方法,尽管旧的SET PASSWORD
语法并未正式弃用.
This is now the preferred method for setting the password, although the older SET PASSWORD
syntax is not officially deprecated.
这篇关于MySQL不允许用户登录:错误1524的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!