1、下載mysql-5.7.17-winx64.zip安裝包(鏈接:https://dev.mysql.com/downloads/mysql/)
2、解壓安裝包。
D:/DevelopTool/mysql-5.7.17-winx64 #解壓目錄
3、在解壓目錄下創建一個名為data的文件夾,用來存放數據
D:/DevelopTool/mysql-5.7.17-winx64/data
4、配置啟動文件
把 D:/DevelopTool/mysql-5.7.17-winx64/my-default.ini 文件copy一份,重新命名為 my.ini ,修改里面的參數,如下:
| # For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[mysqld]# Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin# These are commonly set, remove the # and set as required.# basedir = .....# datadir = .....# port = .....# server_id = .....########################## basedir 為安裝文件解壓后的目錄 | basedir和datadir 可以使用相對路徑# basedir=./..basedir=D://DevelopTool//mysql-5.7.11-winx64# datadir 為用來存放數據的目錄# datadir=./../datadatadir=D://DevelopTool//mysql-5.7.11-winx64//data# port 為端口號port=3306# mar_connections為最大連接數max_connections=20character_set_server=utf8# Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2M explicit_defaults_for_timestamp=truesql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES | 
5、初始化數據目錄
| mysqld --defaults-file="D:/DevelopTool/mysql-5.7.17-winx64/my.ini" --initialize-insecure | 
它會初始化 data 目錄,在執行此命令前請先把data目錄下的所有文件先刪除,否則會失敗
可以選擇用 --initialize-insecure 或者 --initialize 來初始化,--initialize-insecure 初始化root密碼為空,如果用 --initialize來初始化,會產生一個隨機密碼
執行成功后,在data目錄下會生成mysql,perofrmance_schema,sys等目錄文件
6、安裝和啟動mysql服務
| #安裝服務mysqld -install#啟動服務net start mysql#進入mysqlmysql -u root -p#移除mysqlmysqld -remove | 
關于本站給大家提供的mysql專題大家可以參考下:
Mysql在各個系統的安裝教程
Mysql Root密碼操作技巧
MySql數據庫入門教程
MySQL中的數據庫操作知識匯總
新聞熱點
疑難解答