我无法启用二进制日志记录。我在互联网上发现可以通过取消注释log_bin = /var/log/mysql/mysql-bin.log配置文件中的行来启用二进制日志/etc/mysql/my.cnf。但是没有这样的项目。
这是该配置文件中的内容:
# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
我进入文件夹/etc/mysql/conf.d/和/etc/mysql/mariadb.conf.d/文件mysqld.cnf,50-server.cnf找到并取消注释这些行,但仍然没有保留日志。
操作系统:Ubuntu 16.04
试试看:
接下来,重新启动 DBMS:
我们确保二进制日志已经创建并且大小开始增长:
取消注释这一行
log-bin=mysql-bin