您好,登錄后才能下訂單哦!
這篇文章主要講解了“MySQL啟動(dòng)時(shí)丟失數(shù)據(jù)文件不報(bào)錯(cuò)是什么情況”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“MySQL啟動(dòng)時(shí)丟失數(shù)據(jù)文件不報(bào)錯(cuò)是什么情況”吧!
下面就是我的過程:
1、關(guān)閉MySQL數(shù)據(jù)庫
[root@drbd-01 db1]# service mysqld stop
Shutting down MySQL (Percona Server).......................[確定]...
2、刪除MySQL的一個(gè)數(shù)據(jù)文件
[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、重新啟動(dòng)MySQL
[root@drbd-01 db1]# service mysqld start
Starting MySQL (Percona Server).............................................................. [確定]
在丟失數(shù)據(jù)文件 t1.ibd的情況下,數(shù)據(jù)庫居然啟動(dòng)起來了(這在oracle里面簡(jiǎn)直是不允許的)
4、驗(yàn)證
(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)
發(fā)現(xiàn)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、查看錯(cuò)誤日志(還好錯(cuò)誤日志告訴我們數(shù)據(jù)文件曾經(jīng)存在但現(xiàn)在丟了)
[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、結(jié)論
在MySQL數(shù)據(jù)庫啟動(dòng)時(shí),管理員別忘了仔細(xì)觀察你的錯(cuò)誤日志,以便及時(shí)發(fā)現(xiàn)問題。
感謝各位的閱讀,以上就是“MySQL啟動(dòng)時(shí)丟失數(shù)據(jù)文件不報(bào)錯(cuò)是什么情況”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)MySQL啟動(dòng)時(shí)丟失數(shù)據(jù)文件不報(bào)錯(cuò)是什么情況這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。