1、在解压后的主目录下新建my.ini,写入如下内容
[mysqld] basedir ="D:\mysql-5.7.28-winx64" datadir ="D:\mysql-5.7.28-winx64\data" port=33306 server_id =10 character-set-server=gbk character_set_filesystem=gbk [client] port=3306 default-character-set=gbk [mysqld_safe] timezone="CST" [mysql] default-character-set=utf8
2、管理员身份打开cmd,进入bin目录,执行mysqld --install,将MySQL加入到Windows的服务中
D:\mysql-5.7.28-winx64\bin>mysqld --install Service successfully installed.
3、初始化数据库,输入:mysqld --initialize --user=root --console
4、启动MySQL
net start mysql