1.mysql57下载
https://dev.mysql.com/downloads/mysql/
2.解压到你的目标盘
3.mysql环境变量
4.在解压的下级目录创建MySQL配置文件
主要配置端口,字符编码,默认引擎,数据存储目录
[client]
port=3307
[mysql]
default-character-set=utf8
[mysqld]
port=3307
server_id=1
character-set-server=utf8
default-storage-engine=INNODB
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
slow_query_log=0
long_query_time=2
local-infile=0
skip-external-locking
#skip-innodb
#log-bin=mysql-bin
#binlog_format=mixed
max_connections=1000
query_cache_size=0
key_buffer_size=64M
sort_buffer_size=256kb
read_buffer_size=512kb
join_buffer_size=2M
read_rnd_buffer_size=2M
max_allowed_packet=16M
table_open_cache=256
tmp_table_size=64M
max_heap_table_size=64M
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=32M
myisam_repair_threads=1
innodb_buffer_pool_size=64M
innodb_log_file_size=16M
innodb_log_buffer_size=2M
innodb_file_per_table=1
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=50
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size=20M
sort_buffer_size=20M
read_buffer=2M
write_buffer=2M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit=8192
basedir=E:\mysql-5.7.18-winx64
datadir=E:\mysql-5.7.18-winx64\data
5.初始化数据库
用管理员打开power shell(cmd)
shell进入到解压目录执行命令初始化MySQL
mysqld --initialize --user=mysql --console
还要记住初始密码
6.把MySQL安装在window后台服务中
mysqld --install MySQL57
7.启动MySQL服务
net start MySQL57
8.修改密码为root或者其他
登录
mysql -u root -p
修改
set password for root@localhost=password("root")