估計是手欠,一不小心把mysql5.7升到8.0.15,版本高看着就爽啊。
結果是mysql起不起來了。。。
於是想了各種辦法:
- 辦法1:把版本降回去。結果還是不能啓動,說的是用到了高版本的文件,需要刪除所有的數據重裝,這是萬萬不能接受的。
- 辦法2:看錯誤日誌一個問題一個問題解。結果花了一下午,仍然沒有搞定。直到。。。找到這個錯誤
[ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
然後在google上搜“[ERROR] [MY-013129] [Server]”,原來已經有人遇到同樣的問題了:
https://bugs.mysql.com/bug.php?id=89267
1. stop 5.7.21
2. swap binaries for 8.0.4
3. start mysql with skip-networking and skip-grant-tables etc.
4. sudo mysql_upgrade --no-defaults $(sudo my_print_defaults client | egrep '^--socket' | head -1)
5. restart mysql
依樣畫葫蘆:
1.brew services stop mysql
2.mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3.sudo mysql_upgrade --no-defaults $(sudo my_print_defaults client | egrep '^--socket' | head -1)
4.brew services start mysql
問題解決