MYSQL error: Can 'topenfile: '×××. myi' (err

Source: Internet
Author: User
This error is caused by damage to a typical mysql table. The solution is to repair the table. This problem is also common in mysql. The possibility of damage to mysql tables and indexes is high, but it is also very convenient to fix

This error is caused by damage to a typical mysql table. The solution is to repair the table. This problem is also common in mysql. The possibility of damage to mysql tables and indexes is high, but it is also very convenient to fix

The solution to reduce such problems is to minimize the server power failure without reason. When the server is shut down, the mysql database is closed manually.
Let's take a look at this problem:

Can't open file: '×××. myi' (errno: 145). This error is generally caused by damage to your database table files, probably because you moved the database files, of course, other reasons are not excluded.
The error code for the specific database is as follows:
Invalid SQL :......
MySQL error! : 1016 (Can't open file: '×××. myi' (errno: 145 ))
There are multiple 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 Windows, you can:
Run-> cmd
Then: mysql-h host address-u username-p
Enter the password to connect to the database;
Use Database Name;
Enter the name of the table with an error in the reapair table and press enter to fix the problem. See the following figure:

In the second solution, if you can only run PHP code, it is also very simple. Write a PHP file, link it to the database, and put this Code:
Reapair table 'table name ',
Like sending "select *......" It is also possible to send data to mysql;

The third solution is simple. open myphpadmin and select "Can't open file": the table with the same name following it. Select "selected items" from the drop-down menu and select "Repair"

OK.
If your data warehouse is used by one user and you can still control it, it is suggested that you use mysql's self-contained Repair Tool myisamchk.exe to fix it. The operations are as follows:
Stop the mysql service before the fix.
If it is a Windows host, open the command line and enter the/bin directory of mysql.
Execute the myisamchk-r database path \ *. MYI
For Unix-like hosts, directly use the myisamchk-r database directory \ *. MYI

Other references:
Mysql sometimes causes database damage due to power failure or other reasons. The error message is as follows:
MySql: Can't open file: 'sdb _ sessions. myi'. (errno: 145)
For more information, see Help and Support Center
We can use the mysql mysqlcheck command to quickly repair all databases or specific databases. For example
Check to optimize and fix all databases:
# 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
Fix a specified database
# Mysqlcheck-A-o-r Database_NAME-p
IXDBA. NET Community Forum
In addition, you can use myisamchk or isamchk to fix a table.
Here, myisamchk applies to MYISAM data tables, while isamchk applies to ISAM data tables. The main parameters of these two commands are the same. Generally, new systems use MYISAM as the default data table type. Here we use myisamchk as an example. When a problem occurs in a data table, you can use:
Myisamchk tablename. MYI
To fix the issue, use:
Myisamchk-of tablename. MYI
For detailed parameter descriptions of myisamchk, see its help. Make sure that the data table is not accessed by the MySQL server when you modify the data table. It is safe to shut down the MySQL server during detection.
In addition, you can place the following command in your rc. local to start the MySQL server:
[-X/tmp/mysql. sock] & amp;/pathtochk/myisamchk-of/DATA_DIR/*. MYI
/Tmp/mysql. sock is the location of the Sock file monitored by MySQL. For RPM-based installation, it should be/var/lib/mysql. sock. For source code installation, it is/tmp/mysql. sock can be changed based on actual conditions, while pathtochk is the location where myisamchk is located, and DATA_DIR is the location where your MySQL database is stored.

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.