1.官网下载mysql-5.7.28-winx64压缩包版:https://dev.mysql.com/downloads/mysql/
2.解压到C:\Program Files\MySQL目录
3.在目录C:\Program Files\MySQL\mysql-5.7.28-winx64下创建my.ini文件
my.ini内容如下:
[client]
default-character-set=utf8
[mysqld]
port = 3306
basedir=C:\Program Files\MySQL\mysql-5.7.28-winx64
datadir=C:\Program Files\MySQL\mysql-5.7.28-winx64\data
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
[mysqld_safe]
default-character-set=utf8
[mysql]
default-character-set=utf8
4.安装
1)打开cmd命令
2)进入bin目录
cd C:\Program Files\MySQL\mysql-5.7.28-winx64
3)安装
mysqld --install
成功提示Service successfully installed.
若提示安装/删除 服务被拒绝,请使用超级管理员命令打开cmd命令窗口
4)初始化
mysqld --initialize-insecure --user=mysql
5)启动
net start mysql
6)设置用户名密码
mysqladmin -u root -p password 123456
提示输入密码,不用输入,直接回车,连接时使用密码连接
7)测试