基于MySQL官方文档: https://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html
下载MySQL压缩包:https://dev.mysql.com/downloads/mysql/
如果地址更改,也可以按照下图搜索到
现在就安装官方文档配置MySQL:
将刚刚下载的压缩包解压缩到C:\mysql
创建mysql.ini文件到c:\mysql
添加到mysql.ini
[mysqld]
# set basedir to your installation path
basedir=C:/mysql
# set datadir to the location of your data directory
datadir=C:/mysql/data
进入 C:/mysql/bin,执行初始化MySQL的命令,需要以管理员身份开启CMD窗口执行,有时会有权限问题。
mysqld --defaults-file=C:\mysql\my.ini --initialize
执行成功后,会看到mysql/data已经被创建出来了
安装MySQL服务:
$mysqld install MySQL --defaults-file="C:\mysql\my.ini"
Service successfully installed.
启动服务,可以手动启动,也可以命令启动:
$net start mysql
The MySQL service is starting........
The MySQL service was started successfully.
刷新后可以看到服务已经启动:
找到初始化时的密码:
2018-03-07T03:11:27.758730Z 1 [Note] A temporary password is generated for root@localhost: fwPG*,iR.4?C
在这个是日志里面
mysql -u root -p
更改root密码为michael123
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('michael123');
官方文档:https://dev.mysql.com/doc/refman/5.7/en/indexes.html