若是您下载的是解压缩版本,html
一、将下载的 mysql-5.7.13-winx64.zip 解压至须要安装的位置, 如: d: 二、在安装文件夹下找到 my-default.ini 配置文件, 将其重命名为 my.ini , 打开进行编辑, 修改配置文件,将注释打开,以下mysql
[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
三、打开 Windows 环境变量设置, 在 环境变量 的 Path 变量中添加 ;安装路径\bin; 四、 初始化数据库 参数说明参考官网:http://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.htmlsql
C:\Windows\system32>mysqld --defaults-file=D:\mysql-5.7.13-winx64\my.ini --initialize-insecure
默认root密码为空,执行成功后,再data目录下会生成初始化的一些文件 五、启动MySQL数据库
C:\Windows\system32>mysqld --console
六、登陆MySQLcode
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>
七、安装 MySQL 服务,htm
打开Windows命令提示符, 执行命令: mysqld --install 提示"Service successfully installed."表示成功;ip
若是出现 Install/Remove of the Service Denied 错误信息,只须要将cmd以管理员身份打开便可get
启动: net start MySQL 中止: net stop MySQL 卸载: sc delete MySQLinput