第一步:嘗試修改檔案my.ini,發現改了重啟不管用:
C:\Program Files\MySQL\MySQL Server 8.0\bin>notepad my.ini
[mysqld] lower_case_table_names=2
第二步:嘗試初始化mysql服務,帶上引數。注意,會清空資料庫,所以
務必先備份資料!!!
參考:
https://blog.csdn.net/cccgo68/article/details/132295123
C:\Program Files\MySQL\MySQL Server 8.0\bin>net stop mysql80
MySQL80 服務正在停止.
MySQL80 服務已成功停止。
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --remove mysql80
Service successfully removed.
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --initialize --lower_case_table_names=2 --console
2024-05-27T03:26:20.836341Z 0 [System] [MY-013169] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.37) initializing of server in progress as process 18188
2024-05-27T03:26:20.877791Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-05-27T03:26:22.162748Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-05-27T03:26:27.121702Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: BObXz9,gYDF;
上面紅字是root的臨時密碼。
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --install mysql80
Service successfully installed.
C:\Program Files\MySQL\MySQL Server 8.0\bin>net start mysql80
mysql80 服務正在啟動 ..
mysql80 服務已經啟動成功。
捎帶記錄一下,oceanbase相容mysql並不能完全相容,sql指令碼需要替換一下:
1、utf8mb4_0900_ai_ci 換成 utf8_general_ci
2、utf8mb4 換成 utf8