mysql bin log配置及查看


一、mysql bin日志配置:

查案命令:show variables like '%log_bin%'

log_bin:on
log_bin_basename:bin文件路徑及名前綴(/var/log/mysql/mysql-bin)
log_bin_index:bin文件index(/var/log/mysql/mysql-bin.index)
server_id:n

生成的bin日志格式如下:

mysql-bin.000000  mysql-bin.000001

二、日志查看命令:

轉換格式

mysqlbinlog mysql-bin.000000 > mysql-bin.000000.txt 
 
日志內容:
use `dbname`/*!*/;
SET TIMESTAMP=1485064811/*!*/; //開始時間
insert into `users` (`userId`, `userName`) values ('28396', 'helly') //操作sql
/*!*/;
# at 38524047
#170122 14:00:11 server id 1  end_log_pos 38524078 CRC32 0xe8f99830     Xid = 23583291  //服務器id
COMMIT/*!*/;
# at 38524078
#170122 14:00:22 server id 1  end_log_pos 38524167 CRC32 0x64c7f33a     Query    thread_id=63112    exec_time=0    error_code=0
SET TIMESTAMP=1485064822/*!*/;
BEGIN
/*!*/;
# at 38524167
#170122 14:00:22 server id 1  end_log_pos 38524482 CRC32 0x3ff38ff2     Query    thread_id=63112    exec_time=0    error_code=0
SET TIMESTAMP=1485064822/*!*/;
users update `` set `userName` = 'heheli' where `userId` = '28396'
/*!*/;
# at 38524482

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM