您好,登錄后才能下訂單哦!
這篇文章主要講解了“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。