在機器上首次安裝MySQL,
操作系統(tǒng)是win7
mysql 的安裝文件是 zip 格式的,版本是5.7.17
解壓之后,安裝步驟是
1、首先找個文件存放這些安裝程序以及 數(shù)據(jù)
假設(shè)是E:\\mysql
2、把解壓的文件放在E:\\mysql下,并且新建個data文件夾
3、創(chuàng)建環(huán)境變量mysql 路徑是E:\\mysql
添加到path 中 %MYSQL%\bin;
4、在解壓的文件夾下有個my-default.ini
的文件,首先拷貝一份,重命名為my.ini
修改文件內(nèi)容
只修改兩行就行
basedir = E:\\mysql
datadir = E:\\mysql\\data
這兩行原先是用#號注釋掉的,
5、用系統(tǒng)管理員身份啟動命令行
輸入mysqld -install
這個是安裝mysql 服務(wù)的
6、輸入 mysqld --initialize
這個是因為 自動5.7.7版本之后,windows安裝mysql通過zip解壓的方式,不再包含data 文件夾,這個可以參考官網(wǎng)的介紹
http://dev.mysql.com/doc/refman/5.7/en/windows-initialize-data-directory.html
如果沒有data文件夾,則會在啟動mysql服務(wù)的時候起不來,觀察data文件夾下后綴名是.err的文件就可以發(fā)現(xiàn),會報這么一些錯誤
MySQL: Table 'mysql.plugin' doesn't exist
2017-01-01T17:13:33.200113Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-01-01T17:13:33.202113Z 0 [Note] Salting uuid generator variables, current_pid: 6908, server_start_time: 1483290810, bytes_sent: 0,
2017-01-01T17:13:33.237115Z 0 [Note] Generated uuid: '9fb87162-d045-11e6-b092-00ff173a9c42', server_start_time: 1483297718, bytes_sent: 114009376
2017-01-01T17:13:33.241115Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9fb87162-d045-11e6-b092-00ff173a9c42.
2017-01-01T17:13:33.248116Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-01-01T17:13:33.250116Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-01-01T17:13:33.254116Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2017-01-01T17:13:33.259116Z 0 [Note] IPv6 is available.
2017-01-01T17:13:33.260117Z 0 [Note] - '::' resolves to '::';
2017-01-01T17:13:33.261117Z 0 [Note] Server socket created on IP: '::'.
2017-01-01T17:13:33.266117Z 0 [Warning] Failed to open optimizer cost constant tables
2017-01-01T17:13:33.268117Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2017-01-01T17:13:33.270117Z 0 [ERROR] Aborting
其實這是因為這些表示放在data文件夾下的,所以我們需要先執(zhí)行命令mysqld -initialize
在完成mysql 的初始化,這樣的話,mysql會自動完成一些初始化的工作
7、啟動服務(wù) net start mysql
以上所述是小編給大家介紹的解決Mysql5.7.17在windows下安裝啟動時提示不成功問題,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
您可能感興趣的文章:- windows10安裝mysql5.7.17教程
- mysql5.7安裝教程(windows)
- windows下修改Mysql5.7.11初始密碼的圖文教程
- 全面解析Windows下安裝 mysql5.7的方法
- mysql5.7.13.zip安裝教程(windows)