mysql [ERROR] Fatal error: mysql.user table is damaged or in unsupported 3.20 format.

在  Mac OS X裡的 mariadb 無法啟動,執行 mysql.server start 會顯示 Error, Error message:

170502 15:04:31 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2017-05-02 15:04:31 140735690658752 [Note] /usr/local/Cellar/mariadb/10.1.17/bin/mysqld (mysqld 10.1.17-MariaDB) starting as process 58433 ...
2017-05-02 15:04:31 140735690658752 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Compressed tables use zlib 1.2.5
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Using SSE crc32 instructions
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Completed initialization of buffer pool
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: The log sequence numbers 117733696 and 117733696 in ibdata files do not match the log sequence number 117733706 in the ib_logfiles!
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Database was not shutdown normally!
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Starting crash recovery.
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Restoring possible half-written data pages 
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: from the doublewrite buffer...
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-02 15:04:31 140735690658752 [Note] InnoDB: Waiting for purge to start
2017-05-02 15:04:31 140735690658752 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.31-77.0 started; log sequence number 117733706
2017-05-02 15:04:31 123145544421376 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-05-02 15:04:31 140735690658752 [Note] Plugin 'FEEDBACK' is disabled.
2017-05-02 15:04:31 140735690658752 [Note] Recovering after a crash using tc.log
2017-05-02 15:04:31 140735690658752 [Note] Starting crash recovery...
2017-05-02 15:04:31 140735690658752 [Note] Crash recovery finished.
2017-05-02 15:04:31 140735690658752 [Note] Server socket created on IP: '::'.
2017-05-02 15:04:31 140735690658752 [ERROR] Fatal error: mysql.user table is damaged or in unsupported 3.20 format.
170502 15:04:31 mysqld_safe mysqld from pid file /usr/local/var/mysql/Chuns-MacBook-Pro.local.pid ended

170502 15:19:13 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2017-05-02 15:19:13 140735690658752 [Note] /usr/local/Cellar/mariadb/10.1.22/bin/mysqld (mysqld 10.1.22-MariaDB) starting as process 64394 ...
2017-05-02 15:19:13 140735690658752 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Using SSE crc32 instructions
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Completed initialization of buffer pool
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: The log sequence numbers 117733696 and 117733696 in ibdata files do not match the log sequence number 117733716 in the ib_logfiles!
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: 128 rollback segment(s) are active.
2017-05-02 15:19:14 140735690658752 [Note] InnoDB: Waiting for purge to start
2017-05-02 15:19:14 140735690658752 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.35-80.0 started; log sequence number 117733716
2017-05-02 15:19:14 123145402859520 [Note] InnoDB: Dumping buffer pool(s) not yet started
2017-05-02 15:19:14 140735690658752 [Note] Plugin 'FEEDBACK' is disabled.
2017-05-02 15:19:14 140735690658752 [Note] Recovering after a crash using tc.log
2017-05-02 15:19:14 140735690658752 [Note] Starting crash recovery...
2017-05-02 15:19:14 140735690658752 [Note] Crash recovery finished.
2017-05-02 15:19:14 140735690658752 [Note] Server socket created on IP: '::'.
2017-05-02 15:19:14 140735690658752 [ERROR] Fatal error: mysql.user table is damaged or in unsupported 3.20 format.
170502 15:19:14 mysqld_safe mysqld from pid file /usr/local/var/mysql/Chuns-MacBook-Pro.local.pid ended

上面的 Log 分這部份,我先用 brew update 更新 package, 然後用 brew upgrade 去更新 mariadb. 有遇到 brew update 會顯示錯誤,因為 /usr/local/ 目錄沒有寫入權限。

所以先用

sudo chown -R $(whoami) /usr/local

下完這指令就可以有寫入權限了,然後順利從 mariadb 10.1.17 升到 mariadb 10.1.22, 但還是無法啟動,會顯示 Error.


 

使用指令 mysqld –skip-grant-tables 可以啟動 mysqld

再開另外一個  ternimal 就可以用 mysql -u root 連進去 mysql 裡。


透過指令:

brew install mariadb --devel

顯示:

Error: mariadb 10.1.22 is already installed
To upgrade to 10.2.5, run `brew upgrade mariadb`

透過指令:

brew upgrade mariadb

顯示:

Error: mariadb 10.1.22 already installed

透過指令:

brew remove mariadb

顯示:

Uninstalling /usr/local/Cellar/mariadb/10.1.22... (578 files, 140.2MB)
mariadb 10.1.17 is still installed.
Remove all versions with `brew uninstall --force mariadb`.

執行:

brew uninstall –force mariadb

再執行:

brew install mariadb –devel

就可以安裝到 mariadb 10.2.5 版。


相關文章:

Installing MariaDB Server on macOS Using Homebrew

https://mariadb.com/kb/en/mariadb/installing-mariadb-on-macos-using-homebrew/

 

MariaDB 10.2 cannot start on MySQL 5.7 datadir: Fatal error: mysql.user table is damaged or in unsupported 3.20 format

https://jira.mariadb.org/browse/MDEV-11170

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *