mac如何開啟mysql bin-log

藏色散人
發布: 2020-04-24 13:52:00
轉載
2817 人瀏覽過

vim /usr/local/etc/my.cnf 新增以下設定

expire_logs_days = 5 定期清理
log-bin = /usr/local/var/mysql/mysql_bin_log/mysql-bin #开启binlog,指定文件闻之
server_id = 1 #配置mysql replication需要定义,不能和canal的slaveId重复
binlog_format=MIXEDD
登入後複製

mysql.server restart // 重新啟動mysql

show variables like '%log_bin% 查看是否開啟

show master status; 查看日誌狀態

flush logs;刷新日誌,刷新之後會新建一個新的Binlog日誌

reset master 清空目錄下所有日誌檔案

查看日誌檔案:mysqlbinlog --base64- output=DECODE-ROWS -v mysql-bin.000001

/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#200423 16:43:25 server id 1  end_log_pos 123 CRC32 0xb303c132     Start: binlog v 4, server v 5.7.29-log created 200423 16:43:25 at startup
# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
# at 123
#200423 16:43:25 server id 1  end_log_pos 154 CRC32 0x21d20383     Previous-GTIDs
# [empty]
# at 154
#200423 16:45:11 server id 1  end_log_pos 219 CRC32 0xfb334efd     Anonymous_GTID    last_committed=0    sequence_number=1    rbr_only=no
SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/;
# at 219
#200423 16:45:11 server id 1  end_log_pos 295 CRC32 0xb8e6b396     Query    thread_id=4    exec_time=0    error_code=0
SET TIMESTAMP=1587631511/*!*/;
SET @@session.pseudo_thread_id=4/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=1436549152/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
# at 295
#200423 16:45:11 server id 1  end_log_pos 626 CRC32 0xa15900c0     Query    thread_id=4    exec_time=0    error_code=0
use `chunyu`/*!*/;
SET TIMESTAMP=1587631511/*!*/;
UPDATE `article_article` SET `created_time` = '2020-04-23 08:17:20.953805', `last_modified` = '2020-04-23 08:45:11.324532', `user_id` = 1, `title` = '1', `content` = '999999', `status` = 1, `comment_count` = 0, `star_count` = 0 WHERE `article_article`.`id` = 2
/*!*/;
# at 626
#200423 16:45:11 server id 1  end_log_pos 657 CRC32 0xeb7a6863     Xid = 14
COMMIT/*!*/;
SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/;
DELIMITER ;
# End of log file
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
登入後複製

推薦:《mysql影片教學

以上是mac如何開啟mysql bin-log的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:cnblogs.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板