Ubuntu 20.04(焦窝)
# dpkg -l | grep mariadb-server-10
ii mariadb-server-10.3 1:10.3.38-0ubuntu0.20.04.1 amd64 MariaDB database server binaries
# grep -E 'skip_log_error|syslog|log_error' /etc/mysql/ -R | grep -v '#'
/etc/mysql/mariadb.conf.d/50-server.cnf:log_error = /var/log/mysql/error.log
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf:skip_log_error
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf:syslog
# tail -2 /var/log/mysql/error.log
2023-07-28 8:30:23 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.38-MariaDB-0ubuntu0.20.04.1' socket: '/run/mysqld/mysqld.sock' port: 3306 Ubuntu 20.04
Ubuntu 22.04(果酱水母)
# dpkg -l | grep mariadb-server-10
ii mariadb-server-10.6 1:10.6.12-0ubuntu0.22.04.1
# grep -E 'skip_log_error|syslog|log_error' /etc/mysql/ -R | grep -v '#'
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf:skip_log_error
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf:syslog
# tail -2 /var/log/mysql/error.log
tail: cannot open '/var/log/mysql/error.log' for reading: No such file or directory
在 Ubuntu 22.04 之前,MariaDB 日志被写入/var/log/mysql/error.log
. 由于log_error
系统变量显然已在 Ubuntu 22.04 中从 中删除/etc/mysql/mariadb.conf.d/50-server.cnf
,因此情况不再如此。
- 为什么
log_error
从配置文件中删除/etc/mysql/mariadb.conf.d/50-server.cnf
? /var/log/mysql/error.log
尽管skip_log_error
默认情况下使用 日志文件,为什么在 Ubuntu 20.04 中仍然创建日志文件?- 我认为这是由于配置文件的处理顺序造成的,如果是这样,我在哪里可以看到它?
附注
在安装 MariaDB 之前,日志文件不存在。
# ls /var/log/mysql/error.log
ls: cannot access '/var/log/mysql/error.log': No such file or directory
# dpkg -l | grep mariadb-server-10
# apt install mariadb-server
(...)
# dpkg -l | grep mariadb-server-10
ii mariadb-server-10.3 1:10.3.38-0ubuntu0.20.04.1 amd64 MariaDB database server binaries
# ls /var/log/mysql/error.log
/var/log/mysql/error.log