Tuesday, October 8, 2019

mysql Index for table '.\mysql\user.MYI' is corrupt; try to repair it

Here is original source that worked for me

https://stackoverflow.com/questions/57128891/how-repair-corrupt-xampp-mysql-user-table

(1) Find 'my.ini' (eg. c:\xampp\mysql\bin\my.ini )
(2) Insert 'skip-grant-tables' in a new line following label '[mysqld]'. Remove this later.
(3) Now mySQL can be started from the XAMPP control panel.
(4) Start phpMyAdmin from browser and select table 'user' from database 'mysql'
(5) Should see: #1034 Index for table 'user' is corrupt; try to repair it.
(6) Select 'mysql' from left panel then check 'user' in right hand panel.
(7) From the 'With selected' dropdown run 'analyze' then 'repair table'.
(8) If 'Repair' fails no choice but to 'DROP TABLE user' ....
(9) Recreate 'user' table from the distribution backup by copying the following 3 files.
C:\xampp\mysql\backup\mysql\user.frm 
C:\xampp\mysql\backup\mysql\user.MYD
C:\xampp\mysql\backup\mysql\user.MYI
to
C:\xampp\mysql\data\mysql\
then restarting XAMPP and adding/removing/editing users as you wish.

One last point: There seems to be some sort of association between the 'user' and 'db' tables. You may need to repair the 'db' table as per step (7).

1 comment:

  1. " One last point: There seems to be some sort of association between the 'user' and 'db' tables. You may need to repair the 'db' table as per step (7). "

    This actually fix the error for me.. Thank You

    ReplyDelete

Restore xampp database from backup

steps: stop mysql xampp 1 - create some backup folder "data_1"  2 - from your current xampp/mysql/data folder move core folders an...