您好,登录后才能下订单哦!
这篇文章主要讲解了“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启动时丢失数据文件不报错是什么情况这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。