今天在安装web服务器时,出现了mysql的报错,

root@debian-test:~# systemctl start mysql
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xeu mariadb.service" for details.

如下

进一步用

报错如下

root@debian-test:~# systemctl status mariadb.service
x mariadb.service - MariaDB 10.11.6 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Mon 2024-05-06 16:12:08 CST; 6s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 1065 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=ex>
        CPU: 1ms

May 06 16:12:08 debian-test systemd[1]: Starting mariadb.service - MariaDB 10.11.6 database server.>
May 06 16:12:08 debian-test (install)[1065]: mariadb.service: Failed to set up mount namespacing: P>
May 06 16:12:08 debian-test (install)[1065]: mariadb.service: Failed at step NAMESPACE spawning /us>
May 06 16:12:08 debian-test systemd[1]: mariadb.service: Control process exited, code=exited, statu>
May 06 16:12:08 debian-test systemd[1]: mariadb.service: Failed with result 'exit-code'.
May 06 16:12:08 debian-test systemd[1]: Failed to start mariadb.service - MariaDB 10.11.6 database >
lines 1-14/14 (END)
x mariadb.service - MariaDB 10.11.6 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Mon 2024-05-06 16:12:08 CST; 6s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 1065 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, stat>
        CPU: 1ms

May 06 16:12:08 debian-test systemd[1]: Starting mariadb.service - MariaDB 10.11.6 database server...
May 06 16:12:08 debian-test (install)[1065]: mariadb.service: Failed to set up mount namespacing: Permission >
May 06 16:12:08 debian-test (install)[1065]: mariadb.service: Failed at step NAMESPACE spawning /usr/bin/inst>
May 06 16:12:08 debian-test systemd[1]: mariadb.service: Control process exited, code=exited, status=226/NAME>
May 06 16:12:08 debian-test systemd[1]: mariadb.service: Failed with result 'exit-code'.
May 06 16:12:08 debian-test systemd[1]: Failed to start mariadb.service - MariaDB 10.11.6 database server.

图片

经过分析,系统为pve,安装了LXC CT模板debian,有特权的容器,这是因为LXC的安全功能与特权容器有关,修改如下

nano /etc/systemd/system/multi-user.target.wants/mariadb.service

ProtectSystem=full
ProtectHome=true

改为

ProtectSystem=false
ProtectHome=false

然后

systemctl daemon-reload

systemctl start mariadb.service

成功运行。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注