MySQL Won't let User Login: Error 1524

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"

Source: http://kb.odin.com/en/126676

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.

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';

This is now the preferred method for setting the password, although the older SET PASSWORD syntax is not officially deprecated.


mysql_upgrade (suggested by @miken32) wasn't working for me, so I had to do it the hard way, by shutting down the service and using mysqld_safe, as explained here.

UPDATE: Actually, that didn't work either, so I had to do the hard hard hard way (beware, this deletes all your databases):

  1. sudo killall mysqld
  2. sudo rm -rf /var/lib/mysql
  3. sudo apt-get purge mysql-server
  4. Install mysql-server package again.

Tags:

Mysql

Sql