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

What happens if the data file is lost when MySQL starts up and no error is reported?

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

Share

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

This article mainly explains "MySQL startup lost data files do not report error is what situation", the explanation content in the article is simple and clear, easy to learn and understand, please follow the small series of ideas slowly in-depth, together to study and learn "MySQL startup lost data files do not report error is what situation"!

Here is my process:

1. Close MySQL database

[root@drbd-01 db1]# service mysqld stop

Shutting down MySQL (Percona Server)....................... [OK]...

Delete a MySQL data file

[root@drbd-01 db1]# cd /data/mysql/data/db1

[root@drbd-01 db1]# mv t1.ibd t1.ibd.bak

[root@drbd-01 db1]# mv t1.frm t1.frm.bak

[root@drbd-01 db1]# ls

db.opt t1.frm.bak t1.ibd.bak

Restart MySQL

[root@drbd-01 db1]# service mysqld start

Starting MySQL (Percona Server).............................................................. [OK]

In the case of missing data file t1.ibd, the database actually started up (this is simply not allowed in oracle)

4. Verification

(root@localhost)[(none)]> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| db1 |

| mysql |

| performance_schema |

| test |

+--------------------+

5 rows in set (0.17 sec)

(root@localhost)[(none)]> use db1;

Database changed

(root@localhost)[db1]> show tables;

Empty set (0.00 sec)

The t1 table does not exist.

(root@localhost)[db1]> create table t1 (id int);

ERROR 1813 (HY000): Tablespace for table '`db1`.` t1`' exists. Please DISCARD the tablespace before IMPORT.

It's embarrassing not to build a t1 table.

5. Check the error log (fortunately, the error log tells us that the data file used to exist but is now missing)

[root@drbd-01 db1]# tail -100 /data/mysql/logs/mysql-error.log

InnoDB: directories yourself, InnoDB does not create them.

2016-01-08 16:43:12 10462 [ERROR] InnoDB: Could not find a valid tablespace file for 'db1/t1'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.

2016-01-08 16:43:12 10462 [ERROR] InnoDB: Tablespace open failed for '"db1". "t1"', ignored.

2016-01-08 16:43:12 10462 [Note] InnoDB: 128 rollback segment(s) are active.

2016-01-08 16:43:12 10462 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.27-76.0 started; log sequence number 1689915

2016-01-08 16:43:13 10462 [ERROR] InnoDB: Failed to find tablespace for table '"db1". "t1"' in the cache. Attempting to load the tablespace with space id 7.

2016-01-08 16:43:13 7f266daba700 InnoDB: Operating system error number 2 in a file operation.

InnoDB: The error means the system cannot find the path specified.

2016-01-08 16:43:13 10462 [ERROR] InnoDB: Could not find a valid tablespace file for 'db1/t1'. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting-datadict.html for how to resolve the issue.

2016-01-08 16:43:13 10462 [Note] Server hostname (bind-address): '*'; port: 3306

2016-01-08 16:43:13 10462 [Note] IPv6 is available.

6. Conclusion

At MySQL database startup, the administrator should not forget to carefully observe your error log in order to detect problems in time.

Thank you for reading, the above is "MySQL startup lost data files do not report what is wrong" content, after the study of this article, I believe that we start MySQL lost data files do not report what is wrong this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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