window上安装mysql5.7.20版本

1,安装包 &环境变量

将网上下载好的安装包解压到对应的目录(目录最好避免有中文),例如:

D:\Program Files\mysql-5.7.20

 环境变量:在系统变量新建MYSQL_HOME

紧接着在 Path变量中添加 %MYSQL_HOME/bin% 。

以上2个步骤也可以直接在 Path变量中添加:

D:\Program Files\mysql-5.7.20\bin

2,配置文件

官网发布的安装包里没有配置文件,这点官网做的有点不友好。那既然这样,身为程序员那就只能自己search下了,这里我找到一个基础配置文件

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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

[client]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

# These are commonly set, remove the # and set as required.
basedir=D:\Program Files\mysql-5.7.20
datadir=D:\Program Files\mysql-5.7.20\data
port=3306
# master server id
#server_id = 1 
#log-bin=D:\Program Files\mysql-5.7.20\data\backup\mysqlbin
#log-err=D:\Program Files\mysql-5.7.20\data\backup\mysqlerr
# maser can read&write
#read-only=0 
# ignore backup database
#binlog-ignore-db=mysql
# binlog-do-db=eshop

# open slow query log 
slow_query_log=1
slow_query_log_file=D:\Program Files\mysql-5.7.20\logs\slow_query_log.log
# set long query time
long_query_time=3

# set trust function creators
log_bin_trust_function_creators=1

# 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 

 除了下面几项配置,个人认为对于非生产环境,有这几项足够了。

3,命令安装

接下来在使用管理员的CMD命令来到你的 D:\Program Files\mysql-5.7.20\bin 目录

3.1,默认解压包是没有 data目录的,解决方法是执行以下目录:

mysqld --initialize-insecure

3.2,接下来安装命令:

mysqld install

4,启动服务

net start mysql

5,登录 &更改root密码

mysql -uroot -p

root用户在执行 mysqld --initialize-insecure 有个临时密码在 data目录下的 “你的电脑名称”.err文件中,找到复制粘贴即可。

alter user  'root'@'localhost' identified by '新密码';

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值