溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

bin-log以及mysql配置講義

發(fā)布時間:2020-04-26 15:46:09 來源:億速云 閱讀:230 作者:三月 欄目:MySQL數(shù)據(jù)庫

本文主要給大家介紹bin-log以及mysql配置講義,希望可以給大家補充和更新些知識,如有其它問題需要了解的可以持續(xù)在億速云行業(yè)資訊里面關(guān)注我的更新文章的。

一、配置環(huán)境:

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 及以后版本,如果沒有設(shè)置server-id, 那么設(shè)置binlog后無法開啟MySQL服務(wù). (Bug #11763963, Bug #56739)

另外一種配置方式:

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

不過默認(rèn)也是上面這樣的

三個參數(shù)含義:

1、參數(shù)是打開binlog日志

2、參數(shù)是binlog日志的基本文件名,后面會追加標(biāo)識來表示每一個文件

3、參數(shù)指定的是binlog文件的索引文件,這個文件管理了所有的binlog文件的目錄


三、啟動mysql 測試并檢查是否看起成功,如下圖可以看到啟動成功

show variables like '%log_bin%';

bin-log以及mysql配置講義

看了以上關(guān)于bin-log以及mysql配置講義,希望能給大家在實際運用中帶來一定的幫助。本文由于篇幅有限,難免會有不足和需要補充的地方,如有需要更加專業(yè)的解答,可在官網(wǎng)聯(lián)系我們的24小時售前售后,隨時幫您解答問題的。

 



向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI