若是您下載的是解壓縮版本,html
一、將下載的 mysql-5.7.13-winx64.zip 解壓至須要安裝的位置, 如: d: 二、在安裝文件夾下找到 my-default.ini 配置文件, 將其重命名爲 my.ini , 打開進行編輯, 修改配置文件,將註釋打開,以下mysql
[mysqld] innodb_buffer_pool_size = 128M basedir=D:\\mysql-5.7.13-winx64 datadir=D:\\mysql-5.7.13-winx64\\data port=3306 join_buffer_size = 128M sort_buffer_size = 2M read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
三、打開 Windows 環境變量設置, 在 環境變量 的 Path 變量中添加 ;安裝路徑\bin; 四、 初始化數據庫 參數說明參考官網:http://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.htmlsql
C:\Windows\system32>mysqld --defaults-file=D:\mysql-5.7.13-winx64\my.ini --initialize-insecure
默認root密碼爲空,執行成功後,再data目錄下會生成初始化的一些文件 五、啓動MySQL數據庫
C:\Windows\system32>mysqld --console
六、登陸MySQLcode
C:\Users\shuangjun.yang>mysql -u root -p Enter password: 空密碼直接回車 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.13 MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
七、安裝 MySQL 服務,htm
打開Windows命令提示符, 執行命令: mysqld --install 提示"Service successfully installed."表示成功;ip
若是出現 Install/Remove of the Service Denied 錯誤信息,只須要將cmd以管理員身份打開便可get
啓動: net start MySQL 中止: net stop MySQL 卸載: sc delete MySQLinput