文档课题:Windows 2012安装mysql 5.7.21
系 统:Microsoft Windows Server 2012 Standard 64位
数据库:mysql 5.7.21
安装包:mysql-installer-community-5.7.21.0.msi
1、下载
自MySQL版本升级到5.7后,安装和配置过程发生很大变化,以下介绍5.7版本MySQL的下载、安装及配置过程.
针对不同用户,MySQL提供2个版本:
MySQL Community Server(社区版):该版本完全免费,但官方不提供技术支持.
MySQL Enterprise Server(企业版):该版本能够高性价比的为企业提供数据仓库应用,支持ACID事物处理,提供完整的提交、回滚、崩溃恢复和行级锁定功能.但该版本需付费使用,官方提供电话及文档等技术支持.
下载网址:http://dev.mysql.com/downloads/
2、安装
注意:在安装MySQL软件前,需提前安装好.NET Framework 4.5.2,否则安装时会出现如下告警.
说明:此处下载NDP452-KB2901907-x86-x64-AllOS-ENU.exe后进行.NET Framework 4.5.2安装.
以下正式安装MySQL 5.7.21.
A、双击mysql-installer-community-5.7.21.0.msi安装包,弹出用户许可证协议窗口.
B、选中“I accept the license terms” 选择框,点击”Next”按钮,进入选择设置类型.
C、选在”Custom”选项,点击”Next”,进入选择版本和特性界面.
D、单击Mysql Servers -> Mysql Servers ->Mysql Server 5.7 ->Mysql Server5.7.21 -x64 ->添加到右边方框中,然后点击”Next”.
E、点击”Execute”,出现如下对话框后,点击”I agree to the license terms and conditions”后,在点击”Install”.
F、此后出现如下对话框,点击”Next”.
G、出现如下对话框后,点击”Execute”.
H、点击”Next”.
I、点击”Next”.
J、选择”Standalone MySQL Server/Classic MySQL Replication”.
K、配置完端口等相关信息后,点击”Next”.
L、配置好用户名、密码等信息后,点击”Next”.
说明:相关账户、密码配置后,效果图如下.
M、点击”Next”.
点击”Next”.
N、申请服务相关配置,点击”Execute”.
配置完后,效果图如下,此后点击”Finish”.
点击”Next”.
此后效果图如下:
说明:MySQL安装完毕.
3、配置
3.1、添加环境变量
变量名:MYSQL_HOME
变量值:C:\Program Files\MySQL\MySQL Server 5.7 (此为mysql安装目录)
如下所示,进行环境变量的添加.
然后在Path中添加%MYSQL_HOME%\bin,如下所示:
3.2、注册系统服务
将mysql注册为windows系统服务.注意: cmd建议以管理员身份运行.
C:\Users\Administrator> cd C:\Program Files\MySQL\MySQL Server 5.7\bin
--输入服务安装命令
C:\Program Files\MySQL\MySQL Server 5.7\bin> mysqld install MySQL --defaults-file="C:\Program Files\MySQL\MySQL Server 5.7\my-default.ini"
The service already exists!
The current server installed: "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld" --defaults-file="C:\Program Files\mysql\my-default.ini" MySQL
说明:移除服务命令:mysqld remove.
4、相关数据
C:\Users\Administrator>mysql -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> select @@datadir;
+---------------------------------------------+
| @@datadir |
+---------------------------------------------+
| C:\ProgramData\MySQL\MySQL Server 5.7\Data\ |
+---------------------------------------------+
1 row in set (0.00 sec)
mysql> select @@basedir;
+------------------------------------------+
| @@basedir |
+------------------------------------------+
| C:\Program Files\MySQL\MySQL Server 5.7\ |
+------------------------------------------+
1 row in set (0.00 sec)
mysql> show variables like 'log_error';
+---------------+-----------------------+
| Variable_name | Value |
+---------------+-----------------------+
| log_error | .\WIN-12HQ2SAA8ON.err |
+---------------+-----------------------+
1 row in set, 1 warning (0.00 sec)
参考文档:https://cloud.tencent.com/developer/article/1018709
标签:21,5.7,Windows,mysql,Server,点击,MySQL,Next
From: https://blog.51cto.com/u_12991611/6318837