Mysql5.7.25 log使用记录 binlog 设置mysql.ini开启binlog 查看binlog 是否开启 SHOW VARIABLES LIKE "log_bin" mysql.ini配置信息 [mysqld]
设置mysql.ini开启binlog
查看binlog 是否开启
SHOW VARIABLES LIKE "log_bin"
mysql.ini配置信息
[mysqld]
port = 3306
basedir=C:/Development/mysql/mysql-5.7.25-winx64
datadir=C:/Development/mysql/mysql-5.7.25-winx64/data
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
secure_file_priv =
#日志相关设置
#开启日志以及日志存放地点
log_bin = C:/Development/mysql/mysql-5.7.25-winx64/log/mysql-bin
#mysql服务器的唯一标识(MySQL 5.7.3 及以后版本,如果没有设置server-id, 那么设置binlog后无法开启MySQL服务)
server-id = 001
#bin_log保存时间
expire_logs_days = 7
#binlog 文件大小
max_binlog_size = 100m
#binlog 日志存储类型
binlog_fORMat=MIXED
[mysql]
default-character-set=utf8
查看binlog 日志文件的列表
SHOW BINARY LOGS
查看binlog 日志内容
命令
C:Developmentmysqlmysql-5.7.25-winx64in> mysqlbinlog.exe C:Developmentmysqlmysql-5.7.25-winx64logmysql-bin.000001
使用binlog日志做数据恢复
C:Developmentmysqlmysql-5.7.25-winx64in> mysqlbinlog.exe --stop-datetime="2020-07-24 11:09:07" C:Developmentmysqlmysql-5.7.25-winx64logmysql-bin.000003 | mysql -u root -p
删除binlog 日志
RESET MASTER
PURGE MASTER LOGS TO "mysql-bin.000002"
PURGE MASTER LOGS BEFORE "20200724"
show variables like "slow_query_log";
# 开启慢日志
slow_query_log=on
# mysql 慢日志存储地址
slow_query_log_file = C:/Development/mysql/mysql-5.7.25-winx64/log/slow_query.log
# 慢查询判断时间,单位是秒
long-query-time = 3
--结束END--
本文标题: mysql5.7.25 log使用记录
本文链接: https://lsjlt.com/news/7460.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0