如果您下载的是解压缩版本,
安装方法如下
1、将下载的 mysql-5.7.13-winx64.zip 解压至需要安装的位置, 如: d: 2、在安装文件夹下找到 my-default.ini 配置文件, 将其重命名为 my.ini , 打开进行编辑, 修改配置文件,将注释打开,如下
[mysqld]
innodb_buffer_pool_size = 128M
basedir=D:\\mysql-5.7.13-winx64
datadir=D:\\mysql-5.7.13-winx64\\data
port=3306
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
3、打开 Windows 环境变量设置, 在 环境变量 的 Path 变量中添加 ;安装路径\bin; 4、 初始化数据库 参数说明参考官网:http://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html
C:\Windows\system32>mysqld --defaults-file=D:\mysql-5.7.13-winx64\my.ini --initialize-insecure
默认root密码为空,执行成功后,再data目录下会生成初始化的一些文件 5、启动MySQL
C:\Windows\system32>mysqld --console
6、登录MySQL
C:\Users\shuangjun.yang>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.13 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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>
7、安装 MySQL 服务,
打开Windows命令提示符, 执行命令: mysqld --install 提示"Service successfully installed."表示成功;
如果出现 Install/Remove of the Service Denied 错误信息,只需要将cmd以管理员身份打开即可
MySQL服务的启动,停止,卸载
启动: net start MySQL 停止: net stop MySQL 卸载: sc delete MySQL