温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

bin-log以及mysql配置讲义

发布时间:2020-04-26 15:46:09 来源:亿速云 阅读:227 作者:三月 栏目:MySQL数据库

本文主要给大家介绍bin-log以及mysql配置讲义,希望可以给大家补充和更新些知识,如有其它问题需要了解的可以持续在亿速云行业资讯里面关注我的更新文章的。

一、配置环境:

OS:Win10

Mysql:5.7.19

二、我的Mysql配置文件(my.ini)如下:

bin-log以及mysql配置讲义

[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配置讲义

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

 



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI