一、 官网下载
下载自己需要的版本,我使用版本地址如下
https://dev.mysql.com/downloads/file/?id=485477
二、解压配置
1.在解压后的bin文件中添加my.ini 文件(这跟以前低版本不一样)
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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的缓存,可以根据实际情况调整大小,我这里采取默认值
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.
#mysql根目录
basedir = D:\work\mysql-5.7.26-winx64
#数据存储目录
datadir = D:\work\mysql-5.7.26-winx64\data
#端口号,默认为3306
port = 3306
#服务实例的唯一标识,这个是做集群的时候使用,单例可以不配置
# 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
#配置一下服务端的字符集
#character_set_server=utf8mb4 指定后就不要选择库的字符集了
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#配置一下客户端的字符集
[client]
default-character-set=utf8
2.data文件
如果解压目录下没有data文件夹,则创建
三.命令执行
1.进入bin文件夹
执行 mysqld --initialize --user=mysql --console
先执行以上命令, 生成库. 注意有个临时密码, 要记下来.
在方便夹会生成相应的文件
mysqld -install
然后启动服务.
net start MySQL (注意服务名称)
然后再命令行:
mysql -uroot -p
输入密码, 这个密码是临时密码
再输入:
set password = password('root')
改密码成功
四、完成并连接测试