問題描述:
從網(wǎng)上下了5.7 的MySQL,在bin目錄下執(zhí)行 start mysqld ,彈出個(gè)cmd窗口一閃就沒了,也看不清是什么報(bào)錯(cuò)。mysqld --install安裝了服務(wù),也啟動(dòng)不了。
處理步驟:
1、打開事件查看器檢查報(bào)錯(cuò)信息
2、網(wǎng)上查了,都說(shuō)如果是 linux 需要執(zhí)行 mysql_install_db;如果是Windows需要拷貝 user.frm user.MYD和user.MYI
3、不過,http://serverfault.com/questions/291126/mysql-fatal-error-cant-open-and-lock-privilege-tables-table-mysql-host-doe
這里面有人建議使用 mysqld --initialize
執(zhí)行了下,報(bào)錯(cuò):
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --initialize
2016-12-20T04:33:22.298853Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is
deprecated. Please use --explicit_defaults_for_timestamp server option (see doc
umentation for more details).
2016-12-20T04:33:22.298853Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'E
RROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will
be merged with strict mode in a future release.
2016-12-20T04:33:22.298853Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not s
et.
2016-12-20T04:33:22.303853Z 0 [ERROR] --initialize specified but the data direct
ory has files in it. Aborting.
2016-12-20T04:33:22.304853Z 0 [ERROR] Aborting
4、因?yàn)槎际菧y(cè)試數(shù)據(jù),我就直接把 datadir (我的是D:\MysqlData) 文件夾給刪了。再次執(zhí)行mysqld --initialize
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --initialize
5、啟動(dòng)服務(wù)(如果沒有安裝服務(wù)的話需要先 執(zhí)行 mysqld --install)
C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql
MySQL 服務(wù)正在啟動(dòng) .
MySQL 服務(wù)已經(jīng)啟動(dòng)成功。
這種方法比起拷貝 user. 文件的要簡(jiǎn)單,不過需要清除所有數(shù)據(jù),適合在自己的測(cè)試環(huán)境上使用。
您可能感興趣的文章:- windows7下啟動(dòng)mysql服務(wù)出現(xiàn)服務(wù)名無(wú)效的原因及解決方法
- windows無(wú)法啟動(dòng)MySQL服務(wù)報(bào)錯(cuò)1067的解決方法
- Windows下使用批處理實(shí)現(xiàn)啟動(dòng)關(guān)閉mysql
- windows下如何安裝和啟動(dòng)MySQL
- 簡(jiǎn)單解決Windows中MySQL的中文亂碼與服務(wù)啟動(dòng)問題
- windows版本下mysql的安裝啟動(dòng)和基礎(chǔ)配置圖文教程詳解
- Windows下Mysql啟動(dòng)報(bào)1067的解決方法
- Windows10 mysql 8.0.12 非安裝版配置啟動(dòng)方法
- Windows系統(tǒng)下解決PhPStudy MySQL啟動(dòng)失敗問題
- Windows系統(tǒng)下MySQL無(wú)法啟動(dòng)的萬(wàn)能解決方法