I was trying to assign access to a database to the default root
user in my MariaDB database hosted via phpmyadmin and I was getting the following error.
open and lock privilege tables: Index for table 'user' is corrupt; try to repair it
Although not the exact same error but I got similar errors to the above one when trying to perform similar functions like setting password for the user tables or adding privileges to a user.
Let's see how to resolve issues like this:
- First we need to check the tables that have errors or issues.
- For this select the database where you need to repair the tables or find issues. Or select the database where you get errors similar to above.
- Select all the tables in the database at the bottom left corner and choose the option
Check table
. This will show the exact tables where the issue is. - Next the tables with the issue can be selected and repaired as shown in the image below. Alternatively, all the tables in the database can be selected and the option
Repair table
can be selected to repair the tables if possible.
References:
Top comments (1)
Only works for the very old MyISAM storage engine and is not really a helpful tip in 2022