Windows下MySQL 5.7無法啟動的解決方案_Mysql

來源:互聯網
上載者:User

問題描述:

從網上下了5.7 的MySQL,在bin目錄下執行 start mysqld ,彈出個cmd視窗一閃就沒了,也看不清是什麼報錯。mysqld --install安裝了服務,也啟動不了。

處理步驟:

1、開啟事件檢視器檢查報錯資訊

2、網上查了,都說如果是 linux 需要執行 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

執行了下,報錯:

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、因為都是測試資料,我就直接把 datadir (我的是D:\MysqlData) 檔案夾給刪了。再次執行mysqld --initialize

C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --initialize

5、啟動服務(如果沒有安裝服務的話需要先 執行 mysqld --install)

C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql

MySQL 服務正在啟動 .

MySQL 服務已經啟動成功。 

這種方法比起拷貝  user. 檔案的要簡單,不過需要清除所有資料,適合在自己的測試環境上使用。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.