一、MySQL 数据库安装
1、安装 mysql 的组件
mysql 是开源的,完全免费。安装包下载:MySQL :: Download MySQL Installer

mysql 安装之前确保电脑上没有其它 mysql 服务正在运行,防止后续安装出现问题:此电脑 >> 管理 >>

运行安装包:

设置过滤器,显示所有可以安装的组件:

初学者最多安装这4个组件,其它的目前用不到:


设置安装路径:


next >> excute,开始安装组件 >> next,安装完成。
2、配置 mysql server






next >> execute >> finish
3、配置 Samples and Exmaples

excute >> finish
4、检测 MySQL 是否正常运行
查看服务列表,mysql 正在运行:

或 者打开任务管理器 ,查看 mysqld.exe 服务端程序是否执行,如果它执行了,MySQL 就会启动:

检查系统环境变量 Path 中有没有自动添加 MySQL 的 bin 目录,没有就手动添加:

连接 MySQL 数据库:打开 CMD,输入 mysql -uroot -p(-uroot 表示指定 root 管理员用户,-p 表示提示输入与用户对应的密码):

三、配置文件
用于更改数据库软件默认配置,如端口号、数据目录位置、默认存储引擎、默认字符编码集等,存放在默认路径 C:\ProgramData\MySQL\MySQL Server 8.0 下,以 UTF-8 编码存储:

修改配置文件后,需要重启 MySQL 服务。
四、客户端
1、命令行客户端
MySQL 安装好就自带的,终端打开:

2、Workbench
MySQL 官方提供的可视化客户端,注意连接前要启动服务:


3、Navicat
由于 Workbench 不太好用,我们使用 Navicat,现在有免费版,自行下载:Navicat | 免费下载 Navicat Premium Lite
新建连接:


新建查询:
