MySQL 啟動錯誤
C:\mysql\bin>mysqld --console
2024-03-01T09:20:57.254094Z 0 [System] [MY-010116] [Server] C:\mysql\bin\mysqld.exe (mysqld 8.0.36-cluster) starting as process 4888
2024-03-01T09:20:57.286940Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\mysql\data\mysqld_tmp_file_case_insensitive_test.lower-test
2024-03-01T09:20:57.287334Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\mysql\data\mysqld_tmp_file_case_insensitive_test.lower-test
2024-03-01T09:20:57.287367Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\mysql\data\' (OS errno: 2 - No such file or directory)
2024-03-01T09:20:57.288406Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-03-01T09:20:57.288685Z 0 [System] [MY-010910] [Server] C:\mysql\bin\mysqld.exe: Shutdown complete (mysqld 8.0.36-cluster) MySQL Cluster Community Server - GPL.
解決方案
mysqld --initialize-insecure
命令可以初始化數據庫並設置一個空的 root 密碼,這樣可以解決一些權限問題。請注意,這種方法可能會帶來安全風險,因為任何人都可以在不需要密碼的情況下以 root 用戶登錄。在您解決問題後,請記得設置一個安全的 root 密碼。