下载了mysql-advanced-5.7.9-winx64.zip,在win7 x64安装,解压到D:\mysql5.7.9 目录:
解压后如下:
D:\mysql5.7.9 的目录
2015/11/19 23:15 <DIR> .
2015/11/19 23:15 <DIR> ..
2015/11/19 22:56 <DIR> bin
2015/11/20 00:59 <DIR> data
2015/11/19 22:56 <DIR> docs
2015/11/19 22:56 <DIR> include
2015/11/19 22:56 <DIR> lib
2015/10/12 14:14 2,729 LICENSE.mysql
2015/11/20 00:24 <DIR> logs
2015/10/12 14:25 1,141 my-default.ini
2015/11/20 00:03 293 my.ini
2015/11/19 23:29 199 my.ini.bak
2015/10/12 14:14 1,449 README
2015/11/19 22:56 <DIR> share
接着创建my.ini,内容如下:
[mysqld]
basedir = D:/mysql5.7.9
datadir = D:/mysql5.7.9/data
log-error=D:/mysql5.7.9/logs/error.log
port = 3308
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
character_set_server = utf8
[WinMySQLAdmin]
Server=D:/mysql5.7.9/mysqld.exe
[client]
default-character-set=utf8
然后通过mysqld install MySQL –defaults-file="D:/mysql5.7.9/my.ini" 注册windows服务,
服务注册成功,net start mysql 报错
报错内容如下:
2015-11-19T16:24:35.501333Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2015-11-19T16:24:35.502333Z 0 [ERROR] Aborting
这里我折腾了3个小时,最后查找官方文档,需要initialize,
mysqld –defaults-file="D:/mysql5.7.9/my.ini" –initialize –user=mysql
做了后,data目录dir如下:
2015/11/20 00:59 <DIR> .
2015/11/20 00:59 <DIR> ..
2015/11/20 00:57 56 auto.cnf
2015/11/20 00:57 1,703 ca-key.pem
2015/11/20 00:57 1,089 ca.pem
2015/11/20 00:57 1,097 client-cert.pem
2015/11/20 00:57 1,707 client-key.pem
2015/11/20 00:59 5 hc-PC.pid
2015/11/20 00:59 12,582,912 ibdata1
2015/11/20 00:59 12,582,912 ibtmp1
2015/11/20 00:57 492 ib_buffer_pool
2015/11/20 00:59 50,331,648 ib_logfile0
2015/11/20 00:57 50,331,648 ib_logfile1
2015/11/20 00:57 <DIR> mysql
2015/11/20 00:57 <DIR> performance_schema
2015/11/20 00:57 1,703 private_key.pem
2015/11/20 00:57 461 public_key.pem
2015/11/20 00:57 1,097 server-cert.pem
2015/11/20 00:57 1,707 server-key.pem
2015/11/20 00:57 <DIR> sys
做好后,net start mysql 启动成功,my god ,mysql终于安装完成