標籤:mysql
故障背景:
今天在mysql 5.7上用了5.6的備份資料,導致服務啟動失敗
報錯資訊:這是第一個錯誤
日誌提示:'The innodb_system data file './ibdata1' is of
a different size 4864 pages (rounded down to MB)
than the 11264 pages specified in the .cnf file!'
思路:
根據日誌的第一個錯誤資訊開始排查並解決,有可能是第一個錯誤導致其他的錯誤發生
總結:
最終發現ibdata1和ibdata2的大小必須和已存在的這倆檔案大小相同
解決方案:
1、vim /etc/my.cnf
innodb_data_file_path = ibdata1:76M;ibdata2:100M:autoextend
ibdata1和ibdata2的大小要和data目錄下的這個倆檔案大小相同
2、啟動服務
/etc/init.d/mysqld start
服務啟動後遇到的問題:
好不容易服務是起來了,但是日誌還有很多報錯,導致涉及到中繼資料的操作都不能執行....
日誌提示:’performance_schema’.’session_variables’不存在,後來提示結構錯誤:
mysql-workbench Connecting to MySQL server ... Native table 'performance_schema'.'session_variables' has the wrong structure
這類型的報錯一大片!
總結:因5.7的mysql使用了5.6mysql建立的表,導致表結構不相容的原因。
所以檢查下表與目前的版本的相容性,並更新下系統庫就好了
解決方案:
1.輸入:mysql_upgrade -uroot -p123 #檢查表與目前的版本的相容性,並更新下系統庫
2.重啟mysql服務:/etc/init.d/mysqld restart
然後就操作正常了。
mysql 5.7上用了5.6的備份資料,導致服務啟動失敗