MySQL error: Can ' t open file: ' xxx. Myi ' (errno:145) repair method _mysql

Source: Internet
Author: User
The way to reduce this type of problem is to minimize the loss of power to the server and shut down the MySQL database manually when shutting down the server.
Here's a look at this question:

Can ' t open file: ' xxx. Myi ' (errno:145), this error is generally your database table file damage caused by the cause is probably the result of your database files moved to remove the results, of course, not excluding other reasons AH.
The specific database error prompt code is:
Invalid SQL: ...
MySQL Error!: 1016 (Can ' t open file: ' xxx. Myi ' (errno:145))
There are a number of solutions to this problem, if your database can be remotely linked or you can connect to your remote server desktop, and your server system is just windows, then you can:
Run->cmd
Then: Mysql–h host address –u user name –p
Then enter the password to connect to the database;
Use database name;
Then enter: Reapair table name of the error, carriage return, so that the repair can be, the reference picture is as follows:

The second scenario, assuming you can only run PHP code, is also very simple, write a php file, link to the database, and put this code:
Reapair table ' name ',
Like sending "SELECT * ..." to MySQL, is also possible;

The third option, can be simple, open your myphpadmin, select can ' t Open file: A table with the same name, a drop-down menu "checked", select "Fix" as shown:

It's OK.
If your database host is on your own, and you can control it, it is recommended that you use MySQL's own repair tool Myisamchk.exe to repair, the following operations:
Stop the MySQL service before fixing it.
If it is a win host, open the command line and go to MySQL's/bin directory.
Executes the path \* where the Myisamchk-r database resides. Myi
If it is a Unix-like host, use the MYISAMCHK-R database directory \* directly. Myi

Other reference:
MySQL sometimes because of power off or other causes of the database corruption, the wrong message is as follows:
Mysql:can ' t Open file: ' Sdb_sessions. Myi '. (errno:145)
For more information, and the Support Center at
We can use MySQL's own mysqlcheck command to quickly fix all databases or specific databases;
Check to optimize and fix all databases using:
# mysqlcheck-a-o-r-P
Enter Password:
Guestbook.simpgb_avatars OK
Guestbook.simpgb_bad_words OK
Guestbook.simpgb_banlist OK
Guestbook.simpgb_data OK
......
......
......
Mysqlcheck Syntax/html/program/mssql/200711/130.html
Repair the specified database with the
# mysqlcheck-a-o-r database_name-p
Ixdba. NET Community Forum
Also, if you are just fixing a table, you can use: Myisamchk or Isamchk
Where Myisamchk applies to myisam types of data tables, ISAMCHK to ISAM types of data tables. The main parameters of these two commands are the same, and generally the new system uses MyISAM as the default datasheet type, which is illustrated with Myisamchk as an example. When you find a problem with a data table, you can use:
MYISAMCHK TableName. Myi
For testing, if you need to fix it, you can use:
MYISAMCHK-OF TableName. Myi
For a detailed parameter description of MYISAMCHK, see its use help. Need to be aware of when making changes must ensure that the MySQL server does not access this data table, insurance is the best in the case of the MySQL server shutdown off.
In addition, you can put the following command in your rc.local to start the MySQL server before:
[-x/tmp/mysql.sock] &&/pathtochk/myisamchk-of/data_dir/*/*. Myi
The/tmp/mysql.sock is the sock file location that MySQL listens to, the user that uses RPM installs should be/var/lib/mysql/mysql.sock, to use the source code installs is/tmp/ Mysql.sock can be changed according to their actual situation, and Pathtochk is Myisamchk location, Data_dir is your MySQL database storage location.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.