- 下载编译好的二进制文件包: https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.32-winx64.zip
- 解压后放在对应的目录下. 比如 D:/programs/mysql8/
- 写一个配置文件 my.ini 放置在安装目录下. D:/programs/mysql8/my.ini
- 配置文件写入对应的项目, 最重要的两个
[mysqld]
# set basedir to your installation path
basedir=D:/programs/mysql8
# set datadir to the location of your data directory
datadir=D:/programs/mysql8/data
- 初始化数据目录
.\bin\mysqld --initialize-insecure --console //能正常输出说明已经初始化完成, 并生生成了空账号root
- 测试启动
.\bin\mysqld.exe --console
- 作为windows服务安装, 需要用管理员账号运行cmd
D:/programs/mysql8/bin/mysqld.exe --install //提示Service successfully installed. 安装成功
- 修改密码
alter user root@localhost identified by 'xxx';
-. 如果要删除服务
SC DELETE mysql