mysql-5.7.16-winx64 安装
官方下载地址:http://dev.mysql.com/downloads/mysql/
我这里下载的是:MySQL Community Server 5.7.16(Windows (x86, 64-bit), ZIP Archive)
win7 系统安装到D盘根目录
1、将压缩包解压到D盘根目录
D:\mysql-5.7.16-winx64
2、修改D:\mysql-5.7.16-winx64\my-default.ini文件
basedir = D:\mysql-5.7.16-winx64
datadir = D:\mysql-5.7.16-winx64\data
port = 3306
server_id = 1
tempdir = D:\mysql-5.7.16-winx64\temp
skip-grant-tables
skip-networking
完整配置如下:
# 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 = D:\mysql-5.7.16-winx64
datadir = D:\mysql-5.7.16-winx64\data
port = 3306
server_id = 1
tempdir = D:\mysql-5.7.16-winx64\temp
# 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
#修改mysql 配置文件跳过密码验证,密码修改完成后请将他们注释掉
skip-grant-tables
skip-networking
3、添加系统变量MYSQL_HOME,变量值为:D:\mysql-5.7.16-winx64
在系统变量path中添加%MYSQL_HOME%\bin;(记得加英文分号)
4、安装mysql 服务
以系统管理员身份打开cmd命令行,命令行中切换到D:\mysql-5.7.16-winx64\bin目录,输入:
mysqld --install
5、初始化mysql
还是在刚才的命令窗口,输入:
mysqld --initialize
输入命令后会创建data目录及相关文件
6、启动mysql服务
net start MySQL
7、修改root默认密码
用记事本打开D:\mysql-5.7.16-winx64\data\下后缀位.err 的文件。我这里是WIN-6.err。
查找password,这里v%eKW7DekFrt是随机生成的密码,用于下面登陆使用。
[Note] A temporary password is generated for [email protected]: v%eKW7DekFrt
8、执行mysql -uroot -pv%eKW7DekFrt登陆mysql
mysql -uroot -pv%eKW7DekFrt
9、输入命令修改密码
SET PASSWORD = PASSWORD('123456');
密码设置为123456,exit退出MySQL,然后就可以重新登陆了。
------------------------------------------------------------------------------------------------------------
在到第6步,启动MySQL服务时候遇到一个问题,服务无法启动,没有错误信息提示。。。
通过下面命令删除,重新安装了一下,然后启动服务ok。
mysqld --remove 删除mysql服务
mysqld --install 安装mysql服务
mysqld --initialize 一定要初始化
net start mysql 启动服务