本文主要给大家介绍bin-log以及mysql配置讲义,希望可以给大家补充和更新些知识,如有其它问题需要了解的可以持续在天达云行业资讯里面关注我的更新文章的。
一、配置环境:
OS:Win10
Mysql:5.7.19
二、我的Mysql配置文件(my.ini)如下:

[client]
port=3306
default-character-set=utf8
[mysqld]
#Path to install software directory
basedir=E:\mysql-5.7.19
#Path to the database directory
datadir=G:\mysql_data
#Port Number
port=3306
#created and 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)
另外一种配置方式:
#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%';

看了以上关于bin-log以及mysql配置讲义,希望能给大家在实际运用中带来一定的帮助。本文由于篇幅有限,难免会有不足和需要补充的地方,如有需要更加专业的解答,可在官网联系我们的24小时售前售后,随时帮您解答问题的。