I‘m getting the following error in my mysql.log file:
100630 2:03:39 [ERROR] /usr/libexec/mysqld: Incorrect key file for table ‘./app2_db/aix_data_user.MYI’; try to repair it
How do I fix this error and repair my table under UNIX or Linux operating systems?
There are two ways to fix this error and repair mysql table.
Method # 1: Use MySQL Command Line
Login as root user, enter (app2_db is database name):
$ mysql -u root -p app2_db
To check table called aix_data_user, enter at the following mysql> prompt:
mysql> check table aix_data_user;
Sample outputs:
+---------------------+-------+----------+----------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +---------------------+-------+----------+----------------------------------------------------------+ | table aix_data_user | check | warning | Table is marked as crashed | | table aix_data_user | check | warning | 2 clients are using or haven't closed the table properly | | table aix_data_user | check | error | record delete-link-chain corrupted | | table aix_data_user | check | error | Corrupt | +---------------------+-------+----------+----------------------------------------------------------+ 4 rows in set (0.00 sec)
Type the following sql command to repair the aix_data_user table, enter:
mysql> repair table aix_data_user;
Sample outputs:
+---------------------+--------+----------+----------+ | Table | Op | Msg_type | Msg_text | +---------------------+--------+----------+----------+ | table aix_data_user | repair | status | OK | +---------------------+--------+----------+----------+ 1 row in set (0.00 sec)
Option #2: Use mysqlcheck Command
The mysqlcheck command is used to checks, repairs, optimizes, and analyzes mysql tables. The general syntax is as follows:
mysqlcheck [options] db_name [tables] mysqlcheck -u userName -p db_name table1
To check aix_data_user table, enter:
$ mysqlcheck -u root -p app2_db aix_data_user
Sample outputs:
Enter password: aix_data_user OK
To repair the table pass the –auto-repair option to mysqlcheck command:
$ mysqlcheck --auto-repair -u root -p app2_db aix_data_user
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 1 comment... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
I have created a video blog using drupal…recently I deleted duplicate entries in DB and it broke…I am getting following errors…
What can be the reason and solution behind this….