使用MySQL時,偶爾會遇到啟動服務失敗的情況。這時會提示錯誤信息“Table 'mysql.user' doesn't exist”。
2020-09-07T15:05:02.289947Z 0 [ERROR] InnoDB: Table flags are 256 in the data dictionary but the flags in file .\ibdata1 are 0x2! 2020-09-07T15:05:02.295685Z 0 [ERROR] InnoDB: Assertion failure: !page || (ibool)!!page_is_comp(page) == dict_table_get_page_is_comp(ulint) thread 1812 2020-09-07T15:05:02.295705Z 0 [ERROR] InnoDB: Failing assertion: page_is_comp == dict_table_get_page_is_comp(table) 2020-09-07T15:05:02.295716Z 0 [ERROR] InnoDB: InnoDB: ppage 3bb in space 0, page_type 0, fuzzlen 0 InnoDB: Assertion failure in thread 1812 in file dict0dict.cc line 2229
出現這種情況的原因是數據字典的版本和實際文件不對應,導致系統無法正常讀取數據表的信息。
解決方法如下:
1.通過命令行進入MySQL服務: $ mysql -u root -p 2.進入系統存儲庫: mysql>use mysql; 3.重建數據表: mysql>source/mysql_system_tables.sql; 4.重啟MySQL服務: $ net stop mysql $ net start mysql
執行以上步驟后,MySQL服務應該能夠正常啟動,避免了“Table 'mysql.user' doesn't exist”的錯誤提示。