MySQL启动时丢失数据文件不报错是什么状况
发布时间:2022-01-16 11:45:44 所属栏目:MySql教程 来源:互联网
导读:这篇文章主要讲解了MySQL启动时丢失数据文件不报错是什么情况,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习MySQL启动时丢失数据文件不报错是什么情况吧! 下面就是我的过程: 1、关闭MySQL数据库 [root@dr
这篇文章主要讲解了“MySQL启动时丢失数据文件不报错是什么情况”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“MySQL启动时丢失数据文件不报错是什么情况”吧! 下面就是我的过程: 1、关闭MySQL数据库 [root@drbd-01 db1]# service mysqld stop Shutting down MySQL (Percona Server).......................[确定]... 2、删除MySQL的一个数据文件 [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 3、重新启动MySQL [root@drbd-01 db1]# service mysqld start Starting MySQL (Percona Server).............................................................. [确定] 在丢失数据文件 t1.ibd的情况下,数据库居然启动起来了(这在oracle里面简直是不允许的) 4、验证 (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) 发现t1表果真不存在了。 (root@localhost)[db1]> create table t1 (id int); ERROR 1813 (HY000): Tablespace for table '`db1`.`t1`' exists. Please DISCARD the tablespace before IMPORT. 又不让建立t1表,好尴尬。 5、查看错误日志(还好错误日志告诉我们数据文件曾经存在但现在丢了) [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、结论 在MySQL数据库启动时,管理员别忘了仔细观察你的错误日志,以便及时发现问题。 感谢各位的阅读,以上就是“MySQL启动时丢失数据文件不报错是什么情况”的内容了,经过本文的学习后,相信大家对MySQL启动时丢失数据文件不报错是什么情况这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。 (编辑:91站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |