![Mysql 因符号链接日志文件夹失败](https://linux22.com/image/1190319/Mysql%20%E5%9B%A0%E7%AC%A6%E5%8F%B7%E9%93%BE%E6%8E%A5%E6%97%A5%E5%BF%97%E6%96%87%E4%BB%B6%E5%A4%B9%E5%A4%B1%E8%B4%A5.png)
我正在尝试使用符号链接将 /var/log 移动到 /home/shared/var/log,问题是 mysql 崩溃了。
具体过程如下:
service rsyslog stop
mv /var/log/ /home/shared/var
ln -s /home/shared/var/log /var/log
service rsyslog stop
mysql-状态
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2022-10-24 10:10:51 UTC; 1h 24min ago
Process: 1167 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 1180 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 1180 (code=exited, status=1/FAILURE)
Status: "Server shutdown complete"
Error: 9 (Bad file descriptor)
CPU: 154ms
来自 syslog 的一些日志
Oct 24 09:49:45 alfa kernel: [ 861.500725] audit: type=1400 audit(1666604985.104:34): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/mysqld" pid=89994 comm="apparmor_parser"
Oct 24 10:10:45 alfa kernel: [ 8.026192] audit: type=1400 audit(1666606245.678:39): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:45 alfa kernel: [ 8.026341] audit: type=1400 audit(1666606245.678:40): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:45 alfa kernel: [ 8.026463] audit: type=1400 audit(1666606245.678:41): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:45 alfa kernel: [ 8.026515] audit: type=1400 audit(1666606245.678:42): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:45 alfa kernel: [ 8.026561] audit: type=1400 audit(1666606245.678:43): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:45 alfa kernel: [ 8.026604] audit: type=1400 audit(1666606245.678:44): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=740 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:45 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 24 10:10:45 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 24 10:10:46 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 1.
Oct 24 10:10:47 alfa kernel: [ 9.533830] audit: type=1400 audit(1666606247.186:45): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=965 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:47 alfa kernel: [ 9.541263] audit: type=1400 audit(1666606247.194:46): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=965 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:47 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 24 10:10:47 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 24 10:10:47 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 2.
Oct 24 10:10:48 alfa kernel: [ 10.915630] audit: type=1400 audit(1666606248.566:51): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:48 alfa kernel: [ 10.934619] audit: type=1400 audit(1666606248.586:52): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:48 alfa kernel: [ 10.934797] audit: type=1400 audit(1666606248.586:53): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:48 alfa kernel: [ 10.934879] audit: type=1400 audit(1666606248.586:54): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:48 alfa kernel: [ 10.934922] audit: type=1400 audit(1666606248.586:55): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:48 alfa kernel: [ 10.934962] audit: type=1400 audit(1666606248.586:56): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1033 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:48 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 24 10:10:48 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 24 10:10:49 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 3.
Oct 24 10:10:49 alfa kernel: [ 12.223305] audit: type=1400 audit(1666606249.874:57): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1118 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:49 alfa kernel: [ 12.237295] audit: type=1400 audit(1666606249.890:58): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1118 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:49 alfa kernel: [ 12.237467] audit: type=1400 audit(1666606249.890:59): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1118 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:49 alfa kernel: [ 12.237537] audit: type=1400 audit(1666606249.890:60): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/home/shared/var/log/mysql/error.log" pid=1118 comm="mysqld" requested_mask="ac" denied_mask="ac" fsuid=114 ouid=114
Oct 24 10:10:49 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 24 10:10:49 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 24 10:10:50 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 4.
Oct 24 10:10:51 alfa systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Oct 24 10:10:51 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 24 10:10:51 alfa systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Oct 24 10:10:51 alfa systemd[1]: mysql.service: Start request repeated too quickly.
Oct 24 10:10:51 alfa systemd[1]: mysql.service: Failed with result 'exit-code'.g