用 brew
將 mysql
從5.6.22升級到了5.7, 啓動mysql
服務之後發現登陸不進去, 原來的密碼失效, 應該是兩個版本的 mysql.user
表結構的差別形成的, 爲了保留以前的數據, 因此卸載了5.7.x
. 卸載以讓命令後從新指向5.6.22
, 用mysql.server
命令啓動mysql
, 這個時候報錯了,啓動不了:html
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/xxx.local.pid). 此處的
xxx
是我電腦的名字,下同mysql
這個時候先不要去搜索引擎搜索以上的錯誤提示,否則會找到不少不一樣的無效的解決方案,要定位問題仍是先查看日誌,避免作無用功. 我剛開始就是這麼作的,浪費了很多時間.sql
查看日誌/usr/local/var/mysql/xxx.local.err
, 發現如下問題:服務器
2016-08-03 18:18:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-03 18:18:59 81707 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive 2016-08-03 18:18:59 81707 [Note] Plugin 'FEDERATED' is disabled. 2016-08-03 18:18:59 81707 [Note] InnoDB: Using atomics to ref count buffer pool pages 2016-08-03 18:18:59 81707 [Note] InnoDB: The InnoDB memory heap is disabled 2016-08-03 18:18:59 81707 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2016-08-03 18:18:59 81707 [Note] InnoDB: Memory barrier is not used 2016-08-03 18:18:59 81707 [Note] InnoDB: Compressed tables use zlib 1.2.3 2016-08-03 18:18:59 81707 [Note] InnoDB: Using CPU crc32 instructions 2016-08-03 18:18:59 81707 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2016-08-03 18:18:59 81707 [Note] InnoDB: Completed initialization of buffer pool 2016-08-03 18:18:59 81707 [Note] InnoDB: Highest supported file format is Barracuda. InnoDB: No valid checkpoint found. InnoDB: If this error appears when you are creating an InnoDB database, InnoDB: the problem may be that during an earlier attempt you managed InnoDB: to create the InnoDB data files, but log file creation failed. InnoDB: If that is the case, please refer to InnoDB: http://dev.mysql.com/doc/refman/5.6/en/error-creating-innodb.html 2016-08-03 18:18:59 81707 [ERROR] Plugin 'InnoDB' init function returned error. 2016-08-03 18:18:59 81707 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2016-08-03 18:18:59 81707 [ERROR] Unknown/unsupported storage engine: InnoDB 2016-08-03 18:18:59 81707 [ERROR] Aborting
重點在:app
InnoDB: to create the InnoDB data files, but log file creation failed.ui
經過這個關鍵點 google 了一下, 找到解決方法: 刪除ib_logfile0
和ib_logfile1
這兩個文件,不過最好是重命名這兩個文件,就算此方案無效, 還有補救的機會. 接着再啓動mysql
服務器, ok 了.this