mac升級XAMPP 7.1.4之後無法啟動MySQL的解決辦法
>> 2017年7月2日 星期日
我的Mac之前裝了XAMPP 5.X,最近因為架設網站需要php 7的測試環境,於是就把原本穩定運作的XAMPP 5.X升級了。
升級的過程都順利,之後也可以正常運作,可是再重新開機之後,卻發現無法啟動MySQL。(補充說明:這個問題多出現在升級到MariaDB 5.6之後出現)
看到這種狀況,下意識感覺不妙。
於是進入終端機(command)模式,想說用指令啟動看看。看到了錯誤訊息。
閱讀錯誤訊息(檔案位置:/Applications/XAMPP/xamppfiles/var/mysql/XXXXXXX-Pro.local.err,XXXXXXX為你的電腦名稱)的最後幾行找到了問題所在。
錯誤訊息如下,如果你發現與我有相同(類似)的訊息,那這篇就是你可以參考的解決方式了:
2017-06-30 20:54:19 140736512222144 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace mysql/gtid_slave_pos uses space ID: 3 at filepath: ./mysql/gtid_slave_pos.ibd. Cannot open tablespace mysql/slave_relay_log_info which uses space ID: 3 at filepath: ./mysql/slave_relay_log_info.ibdRead more...
2017-06-30 20:54:19 7fffc5d163c0 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./mysql/slave_relay_log_info.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
170630 20:54:19 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,or misconfigured. This error can also be caused by malfunctioning hardware.