根據官方的提示:
Make a fresh installation of mysql when it hang "in service start..."
make this:
open with notepad++ the file my.ini file and to innodb section add this:
#*** INNODB Specific options ***
innodb_buffer_pool_size = 256M
innodb_log_file_size = 256M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = normal
Save the file, after
go a usually on windows
c:\ProgramData\MySQL\MySQL Server5.5\data and cancel this file:
DESKTOP-K1N1S7A.err
ib_logfile0
ib_logfile1
ibdata1
Now you can resume the installation ad yoy see the service start.
Note, If the installation not continue... no problem, close ed remake the installation.
我們在 C:\ProgramData\MySQL\MySQL Server 5.7\下找到 my.ini
用notpad++打開,或者其他專業工具,不要用記事本打開,會破壞配置文件格式,官方也說了用notpad++
ctrl+f 輸入#*** INNODB Specific options ***
在下面添加一下幾列,注意格式
innodb_buffer_pool_size = 256M
innodb_log_file_size = 256M
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = normal
然後保存
此時可以將數據庫安裝界面關掉 了,然後window+r輸入:services.msc 打開服務,找到mysql 點擊啓動
不出意外,報錯
我們看看日誌,發現很多類似報錯Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
這個我猜測是數據庫沒有初始化,導致無法加載 啓動mysql服務必須使用的表
這裏應該有個命令 可以直接初始化,但是我忘記了,就用了個笨方法,去我女朋友電腦,找到 C:\ProgramData\MySQL\MySQL Server 5.7\Data 這個目錄下,把mysql這個文件夾複製到自己電腦的目錄下面,然後在從服務啓動,哎,好了
這個 mysql的我已經共享了 鏈接:https://pan.baidu.com/s/1-w79AISEarQnnMlcSrgapA
提取碼:fab6
被人的文章是參考的,還是要靠自己去解決問題。