1、到mysql官网(http://dev.mysql.com/downloads/mysql/)下载压缩包,我的是win7 64位的,根据自己的系统进行下载
2、解压到自己的目录,我的是 E:\software\dataBase\mysql-5.7.11-winx64,并修改其目录下的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.
[client]
default-character-set=utf8
[mysqld]
port=3306
basedir =E:\software\dataBase\mysql-5.7.11-winx64
datadir =E:\software\dataBase\mysql-5.7.11-winx64\data
tmpdir =E:\software\dataBase\mysql-5.7.11-winx64\data
socket =E:\software\dataBase\mysql-5.7.11-winx64\data\mysql.sock
log-error =E:\software\dataBase\mysql-5.7.11-winx64\data\mysql_error.log
#server_id = 2
#skip-locking
max_connections=100
table_open_cache=256
query_cache_size=1M
tmp_table_size=32M
thread_cache_size=8
innodb_data_home_dir=E:\software\dataBase\mysql-5.7.11-winx64\data
innodb_flush_log_at_trx_commit =1
innodb_log_buffer_size=128M
innodb_buffer_pool_size=128M
innodb_log_file_size=10M
innodb_thread_concurrency=16
innodb-autoextend-increment=1000
join_buffer_size = 128M
sort_buffer_size = 32M
read_rnd_buffer_size = 32M
max_allowed_packet = 32M
explicit_defaults_for_timestamp=true
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
3、cd 到 E:\software\dataBase\mysql-5.7.11-winx64\bin目录
4、执行 mysqld.exe --initialize --user=mysql 命令
5、执行 mysqld.exe -install 安装服务命令
6、执行 net start mysql 检查是否安装成功
7、执行mysql mysql -uroot -p 进入mysql
8、输入密码,第一次密码可以从下面文件中找到
输入密码,进入如下界面
9、执行 set password = password('mysql'); 命令 重新设置密码