MySQL官网下载网址:https://www.mysql.com/downloads/
MySQL Community (GPL) Downloads »
按钮MySQL Community Server
按钮Go to Download Page
按钮(mysql-installer-web-community-8.0.27.1.msi)
右侧的 Download
按钮No thanks, just start my download.
按钮即可完成MySQL安装包的下载操作如果不想进行Oracle账号的注册和登陆的话,直接点击
No thanks, just start my download
即可,这个地方视个人情况自行决定
mysql-installer-web-community-8.0.27.1.msi
Choosing a Setup Type
)页面,选择单选框Developer Default
,单击 Next >
按钮Check Requirements
)界面,该页面显示了所有要安装的组件,单击 Next >
按钮,弹出警告框提示某些产品是不安全的,直接忽略此处的警告即可,单击警告框中的 Yes
按钮Download
)界面,该界面中显示了待安装的各个组件,点击 Excute
按钮,开始安装各个组件并显示各组件的安装进度,安装完成后点击 Next >
按钮installation
页面,点击 Excute
按钮,稍等片刻之后点击 Next >
按钮Product Configuration
)页面,点击 Next >
按钮Type and Networking
)页面,配置数据库服务器的类型和网络连接方式,保持默认设置即可,点击 Next >
按钮
Config Type
下拉框中共有三个选项,分别如下
- Development Computer:适用于除MySQL外还会安装很多其它软件的开发计算机,该版本占用最少量的内存
- Server Computer:适用于除MySQL外还会安装其它服务器应用程序的计算机,是为Web或应用程序服务器提供的版本,该版本占用中等内存
- Dedicated Computer:适用于除数据库服务外不再安装其它程序或软件的计算机,该版本会充分利用可用内存
8. 进入身份验证方法(Authentication Method
)页面,建议使用默认方式,点击 Next >
按钮
9. 进入账户和角色(Accounts and Roles
)页面,该界面中可以给Root用户设置密码和添加新用户(此次示例中不做添加新用户操作),输入root用户登陆密码之后,点击 Next >
按钮
10. 进入windows服务(Windows Service
)页面,该页面可以在Windows服务列表上进行启动/关闭等操作,同时设为在系统启动时自动启动MySQL服务器,使用默认配置即可,点击 Next >
按钮
10. 进入应用配置(Apply Configuration
)页面,单击该界面的 Execute
按钮开始应用配置
10.1 稍等片刻之后发现问题,Initializing database(may take a long time
出现小红x,查看 Log
日志
Beginning configuration step: Writing configuration file Saving my.ini configuration file... Saved my.ini configuration file. Ended configuration step: Writing configuration file Beginning configuration step: Updating Windows Firewall rules Adding a Windows Firewall rule for MySQL80 on port 3306. Attempting to add a Windows Firewall rule with command: netsh.exe advfirewall firewall add rule name="Port 3306" protocol=TCP localport=3306 dir=in action=allow 确定。 Successfully added the Windows Firewall rule. Adding a Windows Firewall rule for MySQL80 on port 33060. Attempting to add a Windows Firewall rule with command: netsh.exe advfirewall firewall add rule name="Port 33060" protocol=TCP localport=33060 dir=in action=allow 确定。 Successfully added the Windows Firewall rule. Ended configuration step: Updating Windows Firewall rules Beginning configuration step: Adjusting Windows service Attempting to grant Network Service require filesystem permissions. Granted permissions. Adding new service New service added Ended configuration step: Adjusting Windows service Beginning configuration step: Initializing database (may take a long time) Attempting to run MySQL Server with --initialize-insecure option... Starting process for MySQL Server 8.0.27... Starting process with command: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console --initialize-insecure=on --lower-case-table-names=1... mysqld: File '.\鐗涢摱榫?bin.index' not found (OS errno 2 - No such file or directory) 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.27) initializing of server in progress as process 12436 The newly created data directory C:\ProgramData\MySQL\MySQL Server 8.0\Data\ by --initialize is unusable. You can remove it. Aborting C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.27) MySQL Community Server - GPL. Process for mysqld, with ID 12436, was run successfully and exited with code 1. Failed to start process for MySQL Server 8.0.27. Database initialization failed. Ended configuration step: Initializing database (may take a long time)
10.2 Log日志中最后三行说明了错误的信息
Failed to start process for MySQL Server 8.0.27. Database initialization failed. Ended configuration step: Initializing database (may take a long time)
10.3 根据错误信息向上回溯Log日志信息,发现日志文件中出现乱码,与之相关的文件可能是my.ini
,
Starting process with command: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console --initialize-insecure=on --lower-case-table-names=1... mysqld: File '.\鐗涢摱榫?bin.index' not found (OS errno 2 - No such file or directory)
10.4 通过记事本打开my.ini
,查看配置信息中出现中文,因此我尝试将中文改成英文
10.5 在应用配置(Apply Configuration
)页面,单击该界面的 Cancel
按钮退出应用配置
10.6 再次点击之前下载好的安装包 mysql-installer-web-community-8.0.27.1.msi
10.7 进入MySQL Installer
页面,重新安装MySQL Server,点击Reconfigure
按钮
10.8 再次进入类型和网络(Type and Networking
)页面,这次对复选框Show Advanced and Logging Options
进行打钩,点击Next >
按钮
10.9 再次进入身份验证方法(Authentication Method
)页面,建议使用默认方式,点击 Next >
按钮
10.10 再次进入账户和角色(Accounts and Roles
)页面,该界面中可以给Root用户设置密码和添加新用户(此次示例中不做添加新用户操作),输入root用户登陆密码之后,点击 Next >
按钮
10.11 再次进入windows服务(Windows Service
)页面,该页面可以在Windows服务列表上进行启动/关闭等操作,同时设为在系统启动时自动启动MySQL服务器,使用默认配置即可,点击 Next >
按钮
10.12 进入日志选项(Logging Options
)界面,将页面涉及乱码的部分都改为英文,点击 Next >
按钮
10.13 进入高级选项(Advanced Options
)页面,使用默认配置信息即可,点击 Next >
按钮
10.14 再次进入应用配置(Apply Configuration
)页面,单击该界面的 Execute
按钮开始应用配置
11 应用配置(Apply Configuration
)页面出现如下截图,代表mysql在windows上安装成功