![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342666279.jpg)
一、 下载MySQL
本篇文章选择的是5.7.31版本
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342797540.jpg)
二、 安装MySQL
1. 选择设置类型
双击运行mysql-installer-community-5.7.31.0.msi,这里选择是自定义安装,所以直接选择“Custom”,点击“Next”
“Developer Default”是开发者默认
“Server only”仅作为服务器安装
“Client only”仅作为客户端安装
“Full”是完整安装
“Custom”是自定义安装
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342713120.jpg)
2. 选择安装的产品和功能
依次点开“MySQL Servers”、“MySQL Servers”、“MySQL Servers 5.7”、“MySQL Servers 5.7.31 -64”,然后点击绿色箭头将选中的版本移植到右边选中框中
注:这里选择的是64位系统
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342788494.jpg)
3. 先选中“MySQL Server 5.7.31” ,之后点击下方的蓝色“Advanced Options”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342749121.jpg)
4. 自定义安装路径和数据存放路径,更改完成之后点击“OK”
注:虽说安装在C盘也没毛病,但是个人建议不要安装到C盘,我安装到了D盘
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342762603.jpg)
5. 直接点击“OK”
注:这里因为选择了我自己创建的路径,故程序提示路径已存在,是否要继续
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342768181.jpg)
6. 更改完成之后点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342880056.jpg)
7. 确认一下安装路径和数据存放路径对不对,没有问题的话就直接点击Next
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342888397.jpg)
8. 直接点击“Yes”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342852915.jpg)
9. 先选中“MySQL Server5.7.31”,若电脑中没有这个环境,会提示安装“Microsoft Visual C++ 2013”环境,点击“Execute”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342828147.jpg)
10. 勾选中之后点击“Install”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342845232.jpg)
11. 安装完成,点击“Close”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342870422.jpg)
12. 看到这个对勾就说明这个环境安装上了,直接点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342978255.jpg)
13. 直接点击“Execute”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342947862.jpg)
14. 出现这个图标就说明安装成功了,直接点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342974170.jpg)
15. 直接点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342937901.jpg)
16. 直接点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342937634.jpg)
17. 选择安装类型
个人学习研究的话选择“Development Computer”则可以,我这里选择是“Development Computer”
Development Computer 适合个人开发学习使用的
Server Computer 是像主要用于像FTP,email,web服务器等等
Dedicated Computer 只用作MySQL服务器
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342972540.jpg)
18. MySQL的默认端口是3306,不需要作修改,直接点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526342998366.jpg)
19. 这里需要设置MySQL的密码,不需要太复杂,设置完了直接点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343086028.jpg)
20. 直接点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343069829.jpg)
21. 直接点击“Execute”,开始安装,点击安装之后需要等待片刻
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343075465.jpg)
22. 点击“Finish”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343077155.jpg)
23. 点击“Next”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343033750.jpg)
24. 点击“Finish”,此时MySQL安装完成
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343067957.jpg)
25. 在开始界面搜索mysql,点击第一个MySQL 5.7 Command Line Client
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343065687.jpg)
26. 输入刚才设置的MySQL的密码,按Enter键(回车键)
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343158147.jpg)
27. 出现下面界面就说明已经安装成功了
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343140083.jpg)
至此,MySQL数据库安装成功
三、 配置环境变量
1. 找到MySQL的安装路径
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343164632.jpg)
2. 右击此电脑选择“属性”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343130814.jpg)
3. 先点击“高级系统设置”,再点击“环境变量”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343142836.jpg)
4. 在“系统变量”中选择“Path”,点击“编辑”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343146860.jpg)
5. 点击“新建”,将MySQL的安装路径添加上去,之后点击“确定”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343186326.jpg)
6. 直接点击“确定”
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343288119.jpg)
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343229965.jpg)
7. 验证环境变量是否配置好,按下“window+R”键 弹出运行框,输入“cmd”进入window命令行
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343222800.jpg)
8. 输入“mysql -u root -p”按下回车
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343254044.jpg)
9. 输入密码,按下“Enter键(回车键)”,出现下面界面则是已经配置成功
![MySQL5.7.31怎么安装和配置](https://img.php.cn/upload/article/000/000/164/168526343224831.jpg)
以上是MySQL5.7.31怎么安装和配置的详细内容。更多信息请关注PHP中文网其他相关文章!