mysql安裝卡在Starting Server
阿新 • • 發佈:2019-01-25
本文遇到的問題比較奇葩,估計價值不大,期待和我遇到同樣問題的有緣人
問題分析
針對mysql.msi安裝,卡在Starting Server停滯不前,並且提示configuration is taking longer than expected...
一般的解決方法:點選開啟連結 來自Stack Overflow,68人認為the answer is useful,因為和我情況不同,不適用
下面安裝程式的日誌:
mysqld: File '.\榪滅▼浼氳瘖-鐥呯悊縐?slow.log' not found (Errcode: 2 - No such file or directory) ...:16:07.284773Z 0 [ERROR] Could not use 榪滅▼浼氳瘖-鐥呯悊縐?slow.log for logging (error 2 - No such file or directory). Turning logging off for the server process. To turn it on again: fix the cause, then either restart the query logging by using "SET GLOBAL SLOW_QUERY_LOG=ON" or restart the MySQL server.
原因是因為計算機名是中文的(非自己電腦,我也很無奈啊),mysql在安裝過程中自動生成的log檔案命名為:計算機名.log,中文亂碼造成檔案無法找到,導致安裝卡在Starting Server這一步。
解決辦法
我首先想到的是修改log檔名,但是mysql.msi似乎無法修改,因此我採用了壓縮包安裝,並且在my.ini指定了log檔名。解壓zip檔案後,在根目錄新建檔案my.ini,鍵入下面內容:
[mysql] # 設定mysql客戶端預設字符集 default-character-set=utf8 [mysqld] #設定3306埠 port = 3306 # 設定mysql的安裝目錄 basedir=D:\\server\\mysql-5.7.21 # 允許最大連線數 max_connections=200 # 服務端使用的字符集預設為8位元編碼的latin1字符集 character-set-server=utf8 # 建立新表時將使用的預設儲存引擎 default-storage-engine=INNODB # 設定mysql資料庫的資料的存放目錄 datadir=D:\\server\\mysql-5.7.21\\data # General and Slow logging. log-output=FILE general-log=0 general_log_file="young.log" slow-query-log=1 slow_query_log_file="young-slow.log" long_query_time=10
mysql壓縮包配置教程:點選開啟連結