MySQL 服务无法在 Ubuntu 16.04 pam_unix 问题上启动

MySQL 服务无法在 Ubuntu 16.04 pam_unix 问题上启动

MySQL Community Server 5.7(通过 apt 安装)在托管虚拟服务器上运行,只有当我重新启动服务器时,服务才会再次成功启动。但即便如此,mysql 服务有时也无法启动。

journalct -xe 显示:

Nov 16 15:10:28 Ubuntu-1604-xenial-64-minimal systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Nov 16 15:10:28 Ubuntu-1604-xenial-64-minimal systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Nov 16 15:10:45 Ubuntu-1604-xenial-64-minimal vsftpd[4760]: pam_unix(vsftpd:auth): check pass; user unknown
Nov 16 15:10:45 Ubuntu-1604-xenial-64-minimal vsftpd[4760]: pam_unix(vsftpd:auth): authentication failure; logname= uid=0 euid=0 tty=f
Nov 16 15:10:58 Ubuntu-1604-xenial-64-minimal systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Nov 16 15:10:58 Ubuntu-1604-xenial-64-minimal systemd[1]: mysql.service: Unit entered failed state.
Nov 16 15:10:58 Ubuntu-1604-xenial-64-minimal systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 16 15:10:58 Ubuntu-1604-xenial-64-minimal systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 16 15:10:58 Ubuntu-1604-xenial-64-minimal systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Nov 16 15:10:58 Ubuntu-1604-xenial-64-minimal systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Nov 16 15:10:58 Ubuntu-1604-xenial-64-minimal systemd[1]: mysql.service: 
Main process exited, code=exited, status=1/FAILURE

因此它说:

[...] vsftpd[4760]: pam_unix(vsftpd:auth): check pass; user unknown
[...] vsftpd[4760]: pam_unix(vsftpd:auth): authentication failure; logname= uid=0 euid=0 tty=f

我不知道这条消息指向什么。

我是否必须编辑服务或 init.d 脚本?有更多 Linux 知识的人知道如何修复此行为吗?

答案1

你正在使用“vsftpd”吗?

也许如果你删除它,就不会再遇到这个问题

sudo apt-get remove vsftpd

答案2

如果没有 sock 文件,那么您需要创建 mysqld.sock 文件并通过以下命令分配 mysql 的所有权:

##touch /var/run/mysqld/mysqld.sock

## chown -R mysql:mysql /var/run/mysqld/mysqld.sock
## chown -R mysql:mysql /var/log/mysql

然后转到你的 my.cnf 文件并注释掉此行:

#log-bin = /var/log/mysql/mysql-bin.log   ----- like this..

相关内容