Ubuntu 上的 mariadb 忽略 my.cnf
mariadb on Ubuntu ignoring my.cnf
MariaDB 版本:10.0.34
Ubuntu 版本:16.04.4 LTS
我正在尝试在新安装的 mariadb 中打开 log_bin。我在 /etc/mysql/conf.d/
:
中创建了一个 binlog.cnf 文件
[mysqld]
server_id=1
log_bin=/var/lib/mysql/mariadb-bin
log_bin_index=/var/lib/mysql/mariadb-bin.index
log_queries_not_using_indexes
binlog-ignore-db=mysql
binlog-ignore-db=performance_schema
binlog-ignore-db=information_schema
binlog-ignore-db=phpmyadmin
binlog-ignore-db=test
所以mysqld --print-defaults
表示读取了config,但是show variables
仍然显示log_bin关闭
# mysqld --print-defaults
mysqld would have been started with the following arguments:
--server_id=1
--log_bin=/var/lib/mysql/mariadb-bin
--log_bin_index=/var/lib/mysql/mariadb-bin.index
--binlog-ignore-db=mysql
--binlog-ignore-db=performance_schema
--binlog-ignore-db=information_schema
--binlog-ignore-db=phpmyadmin
--binlog-ignore-db=test
[...]
> show variables like '%log_bin%';\G";
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin | OFF |
| log_bin_trust_function_creators | OFF |
| sql_log_bin | ON |
+---------------------------------+-------+
文件 /etc/mysql/my.cnf
是一个符号 link 到 /etc/alternatives/my.cnf
而符号 link 到 /etc/mysql/mariadb.cnf
...所以我删除了 my.cnf link 并创建了一个实际的 my.cnf 文件而不是 mariadb.cnf 的副本。根据 的说法,一个错误可能意味着 mariadb 无法遵循 symlinks... 但这并没有改变任何东西。
我已经重启mysql很多次了,我什至试图在my.cnf里放垃圾,看看mysql会不会报错,但是不会。错误日志中没有任何内容,这是 mysql 重新启动时的系统日志:
May 22 16:17:26 smtp2 systemd[1]: Stopping LSB: Start and stop the mysql database server daemon...
May 22 16:17:26 smtp2 mysql[29682]: * Stopping MariaDB database server mysqld
May 22 16:17:27 smtp2 mysql[29682]: ...fail!
May 22 16:17:27 smtp2 systemd[1]: mysql.service: Control process exited, code=exited status=1
May 22 16:17:27 smtp2 systemd[1]: Stopped LSB: Start and stop the mysql database server daemon.
May 22 16:17:27 smtp2 systemd[1]: mysql.service: Unit entered failed state.
May 22 16:17:27 smtp2 systemd[1]: mysql.service: Failed with result 'exit-code'.
May 22 16:17:27 smtp2 systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
May 22 16:17:27 smtp2 mysql[29706]: * Starting MariaDB database server mysqld
May 22 16:17:27 smtp2 mysql[29706]: ...done.
May 22 16:17:27 smtp2 systemd[1]: Started LSB: Start and stop the mysql database server daemon.
/etc/mysql/
中的文件权限
drwxr-xr-x 4 root root 4096 May 22 16:50 .
drwxr-xr-x 108 root root 4096 May 17 06:33 ..
drwxr-xr-x 2 root root 4096 May 22 16:56 conf.d
-rw------- 1 root root 277 Mar 22 16:01 debian.cnf
-rwxr-xr-x 1 root root 1426 Mar 6 10:15 debian-start
-rw-r--r-- 1 root root 869 May 22 15:04 mariadb.cnf
drwxr-xr-x 2 root root 4096 Mar 22 16:01 mariadb.conf.d
-rw-r--r-- 1 root root 868 May 22 16:21 my.cnf
/etc/mysql/conf.d/
中的文件权限
-rw-r--r-- 1 mysql mysql 303 May 22 16:56 binlog.cnf
-rw-r--r-- 1 root root 8 Jan 21 2017 mysql.cnf
-rw-r--r-- 1 root root 55 Jan 21 2017 mysqldump.cnf
/var/lib/mysql/:
中的文件权限
drwxr-xr-x 7 mysql mysql 4096 May 22 16:00 .
drwxr-xr-x 48 root root 4096 May 2 06:16 ..
-rw-rw---- 1 mysql mysql 16384 Apr 11 16:43 aria_log.00000001
-rw-rw---- 1 mysql mysql 52 Apr 11 16:43 aria_log_control
-rw-r--r-- 1 root root 0 Mar 22 16:01 debian-10.0.flag
-rw-rw---- 1 mysql mysql 12582912 May 22 16:58 ibdata1
-rw-rw---- 1 mysql mysql 50331648 May 22 16:58 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Mar 22 16:01 ib_logfile1
-rw-rw---- 1 mysql mysql 0 May 22 15:27 mariadb-bin.index
-rw-rw---- 1 mysql mysql 0 Mar 22 16:01 multi-master.info
drwx------ 2 mysql root 4096 Mar 22 16:01 mysql
-rw-rw---- 1 mysql mysql 0 May 22 14:48 mysql-bin.index
-rw------- 1 root root 15 Mar 22 16:01 mysql_upgrade_info
drwx------ 2 mysql mysql 4096 Mar 22 16:01 performance_schema
drwx------ 2 mysql mysql 4096 Apr 10 16:20 phpmyadmin
drwx------ 2 mysql mysql 4096 May 22 16:58 postfix
drwx------ 2 mysql mysql 4096 Mar 22 16:02 test
我从朋友那里得到了一些帮助:-)
在这个 Ubuntu 版本中,/etc/mysql
目录有几个包含大量 *.cnf 文件的子目录。我将我的 binlog.cnf 放在子目录 conf.d/ 中,但另一个带有空 [mysqld] 部分的文件后来被加载到子目录 mariadb.conf.d 中,覆盖了我的...所以将我的二进制日志配置移动到mariadb.conf.d/50-server.cnf
解决了问题。
MariaDB 版本:10.0.34
Ubuntu 版本:16.04.4 LTS
我正在尝试在新安装的 mariadb 中打开 log_bin。我在 /etc/mysql/conf.d/
:
[mysqld]
server_id=1
log_bin=/var/lib/mysql/mariadb-bin
log_bin_index=/var/lib/mysql/mariadb-bin.index
log_queries_not_using_indexes
binlog-ignore-db=mysql
binlog-ignore-db=performance_schema
binlog-ignore-db=information_schema
binlog-ignore-db=phpmyadmin
binlog-ignore-db=test
所以mysqld --print-defaults
表示读取了config,但是show variables
仍然显示log_bin关闭
# mysqld --print-defaults
mysqld would have been started with the following arguments:
--server_id=1
--log_bin=/var/lib/mysql/mariadb-bin
--log_bin_index=/var/lib/mysql/mariadb-bin.index
--binlog-ignore-db=mysql
--binlog-ignore-db=performance_schema
--binlog-ignore-db=information_schema
--binlog-ignore-db=phpmyadmin
--binlog-ignore-db=test
[...]
> show variables like '%log_bin%';\G";
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin | OFF |
| log_bin_trust_function_creators | OFF |
| sql_log_bin | ON |
+---------------------------------+-------+
文件 /etc/mysql/my.cnf
是一个符号 link 到 /etc/alternatives/my.cnf
而符号 link 到 /etc/mysql/mariadb.cnf
...所以我删除了 my.cnf link 并创建了一个实际的 my.cnf 文件而不是 mariadb.cnf 的副本。根据
我已经重启mysql很多次了,我什至试图在my.cnf里放垃圾,看看mysql会不会报错,但是不会。错误日志中没有任何内容,这是 mysql 重新启动时的系统日志:
May 22 16:17:26 smtp2 systemd[1]: Stopping LSB: Start and stop the mysql database server daemon...
May 22 16:17:26 smtp2 mysql[29682]: * Stopping MariaDB database server mysqld
May 22 16:17:27 smtp2 mysql[29682]: ...fail!
May 22 16:17:27 smtp2 systemd[1]: mysql.service: Control process exited, code=exited status=1
May 22 16:17:27 smtp2 systemd[1]: Stopped LSB: Start and stop the mysql database server daemon.
May 22 16:17:27 smtp2 systemd[1]: mysql.service: Unit entered failed state.
May 22 16:17:27 smtp2 systemd[1]: mysql.service: Failed with result 'exit-code'.
May 22 16:17:27 smtp2 systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
May 22 16:17:27 smtp2 mysql[29706]: * Starting MariaDB database server mysqld
May 22 16:17:27 smtp2 mysql[29706]: ...done.
May 22 16:17:27 smtp2 systemd[1]: Started LSB: Start and stop the mysql database server daemon.
/etc/mysql/
中的文件权限drwxr-xr-x 4 root root 4096 May 22 16:50 .
drwxr-xr-x 108 root root 4096 May 17 06:33 ..
drwxr-xr-x 2 root root 4096 May 22 16:56 conf.d
-rw------- 1 root root 277 Mar 22 16:01 debian.cnf
-rwxr-xr-x 1 root root 1426 Mar 6 10:15 debian-start
-rw-r--r-- 1 root root 869 May 22 15:04 mariadb.cnf
drwxr-xr-x 2 root root 4096 Mar 22 16:01 mariadb.conf.d
-rw-r--r-- 1 root root 868 May 22 16:21 my.cnf
/etc/mysql/conf.d/
中的文件权限-rw-r--r-- 1 mysql mysql 303 May 22 16:56 binlog.cnf
-rw-r--r-- 1 root root 8 Jan 21 2017 mysql.cnf
-rw-r--r-- 1 root root 55 Jan 21 2017 mysqldump.cnf
/var/lib/mysql/:
中的文件权限drwxr-xr-x 7 mysql mysql 4096 May 22 16:00 .
drwxr-xr-x 48 root root 4096 May 2 06:16 ..
-rw-rw---- 1 mysql mysql 16384 Apr 11 16:43 aria_log.00000001
-rw-rw---- 1 mysql mysql 52 Apr 11 16:43 aria_log_control
-rw-r--r-- 1 root root 0 Mar 22 16:01 debian-10.0.flag
-rw-rw---- 1 mysql mysql 12582912 May 22 16:58 ibdata1
-rw-rw---- 1 mysql mysql 50331648 May 22 16:58 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Mar 22 16:01 ib_logfile1
-rw-rw---- 1 mysql mysql 0 May 22 15:27 mariadb-bin.index
-rw-rw---- 1 mysql mysql 0 Mar 22 16:01 multi-master.info
drwx------ 2 mysql root 4096 Mar 22 16:01 mysql
-rw-rw---- 1 mysql mysql 0 May 22 14:48 mysql-bin.index
-rw------- 1 root root 15 Mar 22 16:01 mysql_upgrade_info
drwx------ 2 mysql mysql 4096 Mar 22 16:01 performance_schema
drwx------ 2 mysql mysql 4096 Apr 10 16:20 phpmyadmin
drwx------ 2 mysql mysql 4096 May 22 16:58 postfix
drwx------ 2 mysql mysql 4096 Mar 22 16:02 test
我从朋友那里得到了一些帮助:-)
在这个 Ubuntu 版本中,/etc/mysql
目录有几个包含大量 *.cnf 文件的子目录。我将我的 binlog.cnf 放在子目录 conf.d/ 中,但另一个带有空 [mysqld] 部分的文件后来被加载到子目录 mariadb.conf.d 中,覆盖了我的...所以将我的二进制日志配置移动到mariadb.conf.d/50-server.cnf
解决了问题。