1、下载
1 MySQL Community Server 5.7.18
2 https://dev.mysql.com/downloads/mysql/
2、解压
如果想要让MySQL安装在指定目录,那么就将解压后的文件夹移动到指定目录,如:D:\Program Files\mysql-5.7.18-winx64
3、初始化
MySQL解压后的 bin 目录下有一大堆的可执行文件,执行如下命令初始化数据:
注意cmd需要以管理员方式运行,不然会报错:
mysqld: Could not create or access the registry key needed forthe MySQL application
to log to the Windows EventLog. Run the application with sufficient
privileges once to create the key, add the key manually,orturn off
loggingfor that application.
1 cd D:\Program Files\mysql-5.7.18-winx64\bin2
3 mysqld --initialize-insecure
4、启动MySQL服务
执行命令从而启动MySQL服务
1 #进入可执行文件目录2 cd D:\Program Files\mysql-5.7.18-winx64\bin3
4 #启动MySQL服务5 mysqld
5、启动MySQL客户端并连接MySQL服务
由于初始化时使用的【mysqld --initialize-insecure】命令,其默认未给root账