1. 解壓

2. 環(huán)境變量
新增環(huán)境變量 MYSQL_HOME
image.png追加環(huán)境變量 PATH
image.png
3. 配置文件內(nèi)容
# 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 = D:\workingSoftware\mysql-5.7.17-winx64
datadir = D:\workingSoftware\mysql-5.7.17-winx64\data
# port = .....
# server_id = .....
# 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
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
安裝和初始化
進入 mysql 的 bin 文件夾以管理員身份運行 cmd
執(zhí)行
mysqld install,在服務(wù)中會出現(xiàn) MySQL 服務(wù)(如果不用管理員身份運行,將會因為權(quán)限不夠而出現(xiàn)錯誤:Install/Remove of the Service Denied!)
(Windows 移除服務(wù)命令:sc delete mysql)image.pngimage.png執(zhí)行
mysqld --initialize --console(此時會在 mysql 根目錄下生成 data 文件夾)image.pngimage.png
“qZ*Hyh=-u59=”為 root 賬號初始密碼,記住這個密碼。
如果忘記或者沒記住,刪掉初始化的 data 目錄,再執(zhí)行一遍初始化命令(mysqld --initialize --console),又會重新生成。當(dāng)然也可以使用安全工具強制改密碼,用什么方法,自己隨意。
啟動 MySQL
cmd 中繼續(xù)輸入
net start mysql啟動 mysqlimage.png停止 MySQL:
net stop mysql
修改 MySQL 賬號密碼
登錄
(密碼是生成的 “qZ*Hyh=-u59=”):
mysql -uroot -p
image.png修改密碼執(zhí)行以下命令:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
flush privileges;
image.png








