1、下载MySQL文件:http://dev.mysql.com/downloads/file/?id=461109
2、解压MySQL文件,如C:/Program Files/mysql-5.7.11-winx64
3、在解压目录下创建data文件夹:即为C:/Program Files/mysql-5.7.11-winx64/data,截图如下
4、修改配置文件,用以下内容替换 my-default.ini (D:\MySQL\mysql-5.7.11-winx64目录下)内容即可:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir=C:/Program Files/mysql-5.7.11-winx64/ # 设置mysql的解压目录,注意修改你的路径
datadir=C:/Program Files/mysql-5.7.11-winx64/data # 设置mysql数据库的数据的存放目录,必须是data ,注意修改路径,data不能变
port = 3306 #设置端口号
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
5、配置环境变量:计算机-->属性-->高级系统设置-->环境变量,双击系统变量中的Path,在后边添加自己的MySQL bin目录路径:C:\Program Files\mysql-5.7.11-winx64\bin,注意与同英文的分号与之前的隔开。
6、注册MySQL服务:计算机-->Windos-->System32-->以管理员身份运行cmd,将目录切换到MySQL的bin目录,然后分别输入命令
mysqld --initialize-insecure --explicit_defaults_for_timestamp
mysqld --install MySQL
显示:Service successfully installed.即为服务安装成功。
7、启动MySQL服务:net start MySQL 显示服务启动成功即可
MySQL配置完成。