632fr 发表于 2017-8-28 10:08:26

Windows下Mysql 5.7.19 开启bin-log以及mysql配置

一、配置环境:
OS:Win10
Mysql:5.7.19
二、我的Mysql配置文件(my.ini)如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

port=3306
default-character-set=utf8


#Path to install software directory
basedir=E:\mysql-5.7.19

#Path to the database directory
datadir=G:\mysql_data

#Port Number
port=3306

#createdand no character set is defined
character_set_server=utf8

#Set the SQL mode to strict
sql_mode="NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER,STRICT_TRANS_TABLES"
explicit_defaults_for_timestamp=true

# Binary Logging
log-bin=mysql-bin
binlog-format=Row

#The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

#General and Slow logging
log-output=FILE
general-log=0
general_log_file="yuri.log"
slow-query-log=1
slow_query_log_file="yuri-slow.log"
long_query_time=10

#Error Logging
log-error="yuri.err"

#Server ID
server-id=201609




备注:
在MySQL 5.7.3 及以后版本,如果没有设置server-id, 那么设置binlog后无法开启MySQL服务. (Bug #11763963, Bug #56739)
另外一种配置方式:

1
2
3
#log_bin=ON
#log_bin_basename=G:\mysql_data\mysql-bin
#log_bin_index=G:\mysql_data\mysql-bin.index




不过默认也是上面这样的
三个参数含义:
1、参数是打开binlog日志
2、参数是binlog日志的基本文件名,后面会追加标识来表示每一个文件
3、参数指定的是binlog文件的索引文件,这个文件管理了所有的binlog文件的目录

三、启动mysql 测试并检查是否看起成功,如下图可以看到启动成功
show variables like '%log_bin%';



页: [1]
查看完整版本: Windows下Mysql 5.7.19 开启bin-log以及mysql配置