Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Recovery method of MySQLMyISAM table structure

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "the recovery method of MySQLMyISAM table structure". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

It is also assumed that the FRM file of the table to be restored is test_myisam.frm, and the table structure is

Mysql > createtabletest_myisam- > (Aint (11) defaultNULL,- > Bvarchar (30) defaultNULL,- > CdatedefaultNULL) engine=myisam;QueryOK,0rowsaffected (0.05sec)

What is the recovery method of MySQLMyISAM table structure

The recovery process is as follows:

1. Copy the test_myisam.frm directly to the corresponding data directory of the normal database. This is the test.

Mysql > showtables;+-+ | Tables_in_aa | +-+ | test_innodb | | test_myisam | +-+ 3rowsinset (0.00sec) mysql > desctest_myisam;ERROR1017 (HY000): Can'tfindfile:'test_myisam' (errno:2)

It is found that the table name can only be seen through the showtables command, but the table structure is still not restored, and the desc command reports an error.

two。 Create the following 2 files in the same directory as test_myisam.frm. The contents of the files can be empty:

Test_myisam.MYDtest_myisam.MYI

3. From the MYSQL command line, use the MYSQL own data table recovery command repair command to restore the table, as follows:

Mysql > repairtabletest_myisamUSE_FRM +-+ | Table | Op | Msg_type | Msg_text | +-+ | aa.test_myisam | repair | status | OK | +- -+ 1rowinset (0.00sec)

According to the result, you can see that the restore command was executed successfully. Test it with the desc command below:

Mysql > desctest_myisam +-+-+ | Field | Type | Null | Key | Default | Extra | +-+-+ | A | int (11) | YES | | NULL | | B | varchar (30) | YES | | NULL | | C | date | YES | | NULL | +-| -+-+ 3rowsinset (0.02sec)

The recovery was a success.

This is the end of the content of "recovery method of MySQLMyISAM table structure". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report