Mac下MAMP Pro 啓動數據庫MySQL出錯導致無法啓動的問題

問題1:

InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
130305 19:49:08  InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
130305 19:49:08  InnoDB: Operating system error number 35 in a file operation.

此問題的關鍵在於:

Check that you do not already have another mysqld process

表示有多個mysql進程正在執行,解決方法如下:

1、打開終端,輸入$ ps aux | grep mysqld 檢查mysql進程打開終端,輸入$ ps aux | grep mysqld 檢查mysql進程


2.找到相應的進程號,停掉相應的進程,最後保留一條mysql的進程即可

比如:$ kill 1234(此處1234 爲你的進程號)



然後就可以正常使用你的mysql 了。





問題2:

2017-07-31 10:37:08 12746 [Note] Plugin 'FEDERATED' is disabled.
2017-07-31 10:37:08 12746 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-07-31 10:37:08 12746 [Note] InnoDB: The InnoDB memory heap is disabled
2017-07-31 10:37:08 12746 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-07-31 10:37:08 12746 [Note] InnoDB: Memory barrier is not used
2017-07-31 10:37:08 12746 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-07-31 10:37:08 12746 [Note] InnoDB: Using CPU crc32 instructions
2017-07-31 10:37:08 12746 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-07-31 10:37:08 12746 [Note] InnoDB: Completed initialization of buffer pool
2017-07-31 10:37:08 12746 [Note] InnoDB: Highest supported file format is Barracuda.
2017-07-31 10:37:08 12746 [Note] InnoDB: The log sequence numbers 1638988 and 1638988 in ibdata files do not match the log sequence number 1644885 in the ib_logfiles!
2017-07-31 10:37:08 12746 [Note] InnoDB: Database was not shutdown normally!
2017-07-31 10:37:08 12746 [Note] InnoDB: Starting crash recovery.
2017-07-31 10:37:08 12746 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-07-31 10:37:08 12746 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace info/test uses space ID: 3 at filepath: ./info/test.ibd. Cannot open tablespace mysql/slave_relay_log_info which uses space ID: 3 at filepath: ./mysql/slave_relay_log_info.ibd
2017-07-31 10:37:08 7ffff2e8f3c0  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.

此問題的關鍵在於:

InnoDB: Attempted to open a previously opened tablespace. Previous tablespace db_patients/tb_patients uses space ID: 3 at filepath: ./db_patients/tb_patients.ibd. Cannot open tablespace mysql/slave_relay_log_info which uses space ID: 3 at filepath: ./mysql/slave_relay_log_info.ibd

解決辦法:


一、打開MAMP PRO,選擇菜單欄File->Edit Template->MySQL->5.5.3(選擇你的版本)),這時打開了一個文本,找到

[mysqld]
注意帶上中括號,在這行下面加一行
innodb_force_recovery = 1 (可換1-6 進行嘗試)


二、啓動mySQL,成功後再關閉;



三、重新打開那個文本,刪除添加的 innodb_force_recovery = 1 行;



四、再打開mySQL,完畢。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章