转自https://blog.csdn.net/hellboy0621/article/details/80458892
2、考虑到数据库容量会增加,建议解压缩到可用容量较大的盘符,我解压缩到D盘;
3、进入解压缩目录,新建my.ini文件,内容如下:
[mysqld]
# set basedir to your installation path
basedir=D:/mysql-5.7.22-winx64
# set datadir to the location of your data directory
datadir=D:/mysql-5.7.22-winx64/data
4、使用cmd进入解压缩目录下的bin/目录下
# 安装mysql服务,安装完成后,可在右键“计算机”-“管理”-“服务”中看到,默认服务名为“MySQL”,也可以在install后面指定服务名称
D:\mysql-5.7.22-winx64\bin>mysqld install
Service successfully installed.
# 初始化data目录
D:\mysql-5.7.22-winx64\bin>mysqld.exe --initialize
初始化后会在datadir路径下生成一个*.err的文件,打开如下:
2018-05-27T04:49:08.182952Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-27T04:49:11.016957Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-27T04:49:11.546958Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-27T04:49:11.676958Z 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: 4c70979b-6169-11e8-9db4-00ff13a6d817.
2018-05-27T04:49:11.676958Z 0 [Warning] Gtid ta