安装环境
WIN7 x64
mysql-5.7.11-winx64
SQLyog - 64 bit
安装过程
1.安装,直接解压mysql-5.7.11-winx64.zip到指定目录。
2.配置系统环境变量PATH中配置D:\A_DevTools\mysql-5.7.11-winx64\bin,方便CMD中命令的直接操作。
3.配置参数数据库参数文件,打开D:\A_DevTools\mysql-5.7.11-winx64\bin\my-default.ini。
# 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
default-character-set=utf8
character-set-server=utf8
# These are commonly set, remove the # and set as required.
basedir = D:\A_DevTools\mysql-5.7.11-winx64
datadir = D:\A_DevTools\mysql-5.7.11-winx64\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
根据需要进行参数配置,例如我其中配置了如下 参数
default-character-set=utf8
character-set-server=utf8
basedir = D:\A_DevTools\mysql-5.7.11-winx64
datadir = D:\A_DevTools\mysql-5.7.11-winx64\data
port = 3306
4.CMD中运行如下命令:
1) 根据datadir=D:\A_DevTools\mysql-5.7.11-winx64\data在data目录中初始化注册服务安装需要的数据信息,完成后可看到data下多了一些文件;-insecure表示默认root账户无密码。
mysqld --initialize-insecure
2) 注册服务安装,完成后可在系统services中看到启动项,命令中参数--defaults-file=可省略
mysqld install MySQL --defaults-file="D:\A_DevTools\mysql-5.7.11-winx64\my-default.ini"
3) 启动服务,相当于在services中启动一样
net start MySQL
4) 移除服务,该命令用于从services中移除启动服务
mysqld remove MySQL
效果图如下:
如果操作有误,导致服务无法启动,请先删除data目录(以便mysqld --initialize-insecure能正确初始化),按步骤重新操作尝试。
5.使用客户端工具进行连接操作,连接成功后记得修改空密码。
来源:oschina
链接:https://my.oschina.net/u/1017184/blog/634368