gpt4 book ai didi

mysql - Ubuntu 20.04 - 停止了 MySQL。现在它不会启动(错误 13,权限被拒绝)

转载 作者:行者123 更新时间:2023-12-05 08:22:06 24 4
gpt4 key购买 nike

在 Ubuntu 20.04 上运行 DigitalOcean LAMP Stack (1GB VPS),上传媒体文件时,我在 Wordpress 中遇到间歇性的“Error establshing a database connection”错误。这引发了以下 Apache 错误:

WordPress 数据库错误 MySQL server has gone away for query...

发生此问题时,MySQL 日志重复打印以下内容,此后没有其他内容:

    2020-12-19T12:14:43.708558Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-19T12:14:43.992793Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22-0ubuntu0.20.04.3' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu).
2020-12-19T12:14:59.498001Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22-0ubuntu0.20.04.3) starting as process 190645
2020-12-19T12:14:59.512933Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-19T12:15:00.093514Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-19T12:15:00.448326Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2020-12-19T12:15:00.524531Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2020-12-19T12:15:00.543848Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2020-12-19T12:15:00.652394Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

我试过这个修复:WordPress database error MySQL server has gone away for query

网站仍然显示错误,所以我想我应该重新启动 MySQL,但它不会重新启动。

使用 sudo service MySQL start,我得到

mysql.service 的作业失败,因为控制进程已退出并显示错误代码。有关详细信息,请参阅“systemctl status mysql.service”和“journalctl -xe”。

运行第一个命令:

● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-12-19 12:45:50 UTC; 1min 3s ago
Process: 192068 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 192076 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 192076 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 13 (Permission denied)

运行第二个命令

 Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
Pass -q to turn off this notice.
-- Defined-By: systems
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 8.
Dec 19 12:13:48 server systemd[189372]: Listening on REST API socket for snapd user session agent.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systems
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 11.
Dec 19 12:13:48 server systemd[189372]: Listening on D-Bus User Message Bus Socket.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systems
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 9.
Dec 19 12:13:48 server systemd[189372]: Reached target Sockets.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systems
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 5.
Dec 19 12:13:48 server systemd[189372]: Reached target Basic System.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systems
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 2.
Dec 19 12:13:48 server systemd[189372]: Reached target Main User Target.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systems
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 1.
Dec 19 12:13:48 server systemd[189372]: Startup finished in 168ms.
-- Subject: User manager start-up is now complete
-- Defined-By: systems
-- Support: http://www.ubuntu.com/support
--
-- The user manager instance for user 1000 has been started. All services queued
-- for starting have been started. Note that other services might still be starting
-- up or be started at any later time.
--
-- Startup of the manager took 168965 microseconds.
Dec 19 12:15:07 server sudo[190726]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Dec 19 12:15:09 server sudo[190726]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Dec 19 12:30:17 server sudo[191518]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Dec 19 12:30:19 server sudo[191518]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Dec 19 12:32:25 server sudo[191686]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Dec 19 12:32:27 server sudo[191686]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory

第一个错误让我想到了这个:https://askubuntu.com/questions/1228827/mysql-error-13-permission-denied

但是 MySQL 已经拥有/var/lib/mysql。/usr/sbin/mysqld 的所有者是 root。这与在 MySQL 工作正常的另一台服务器上相同。我真的应该改变这个吗?

最佳答案

问题是我已将 /var/log/mysql 的所有权授予我的用户以读取文件。 sudo chown mysql:mysql -R/var/log/mysql 允许我启动 mysql

关于mysql - Ubuntu 20.04 - 停止了 MySQL。现在它不会启动(错误 13,权限被拒绝),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65370142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com