0

Whenever I try to do a DB query with a particular DB user (myuser) I get the following error:

Access denied for user 'myuser'@'localhost' to database 'mydatabase' [1044]

I decided to check the grants for that user and saw that one of the grants could maybe benefit from an update so I tried to update it and got the following error:

Error Code: 1728. Cannot load from mysql.db. The table is probably corrupted

I Google'd the error and found Cannot load from mysql.proc. The table is probably corrupted , which recommends doing mysql_upgrade -u root -pxxx. I tried that and got this error:

Error occurred: The mysql.session exists but is not correctly configured. The mysql.session needs SELECT privileges in the performance_schema database and the mysql.db table and also SUPER privileges.

I Google that error and found MySQL Upgrade Issue but the answer there isn't applicable - there appears to be just one mysql.session user when I do SELECT * FROM mysql.user;. So I figured maybe I'll just create the GRANTs myself:

GRANT SELECT ON `performance_schema`.* TO 'mysql.session'@'localhost';
GRANT SELECT ON `mysql`.`db` TO 'mysql.session'@'localhost';
GRANT SUPER ON *.* TO 'mysql.session'@'localhost';

Only problem: when I attempt to do so I get the same "Error Code: 1728. Cannot load from mysql.db. The table is probably corrupted" that I got before.

My question is... what can I do to fix this? I have a full DB backup that I restored from without issue a few months ago and if there have been any DB changes that have occurred in the DB since then I'm okay with losing. Maybe my best option is to simply uninstall MySQL and re-install it? And if that is the case then are there any steps I can take to prevent this issue from cropping up again?

I'm running MySQL 5.7.25-0ubuntu0.16.04.2 on Ubuntu 16.04.5 LTS on a Digital Ocean droplet.

Any ideas?

edit: I also get this error when I try to create a new MySQL user:

CREATE USER username IDENTIFIED BY 'password';

I tried mysqlcheck -uroot mysql db and got this back:

mysql.db                                           OK

I tried ls -latr /var/lib/mysql/mysql/db* and got this back:

-rw-r----- 1 mysql mysql   65 Nov  8 03:55 db.opt
-rw-r----- 1 mysql mysql  440 Nov 10 17:51 db.MYD
-rw-r----- 1 mysql mysql 5120 Feb 11 11:54 db.MYI
-rw-r----- 1 mysql mysql 9582 Feb 11 11:54 db.frm

I note that there's not an *.ibd file idk.

SELECT * FROM mysql.db, while logged in as both SSH root / MySQL, works without issue, but all the "Error Code: 1728. Cannot load from mysql.db. The table is probably corrupted" errors are also coming to me while logged in as SSH root / MySQL root so idk.

  • What were you running when you got the errors? This belongs at dba.stackexchange.com, where there are more people versed in the details of MySQL. – Rick James Feb 12 at 16:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.