我最近在 Ubuntu VServer 16.04 上安装了 Koha 库,使用的是 MariaDB 10.31。一切都运行顺利,直到 Root 重新启动:现在我收到:软件错误:
DBIx::Class::Storage::DBI::catch {...}():DBI 连接失败:无法通过套接字“/var/run/mysqld/mysqld.sock”(111)连接到本地 MySQL 服务器,位于 /usr/share/perl5/DBIx/Class/Storage/DBI.pm 第 1492 行。位于 /usr/share/koha/lib/Koha/Database.pm 第 100 行
当我尝试连接到网站时。我立即检查了 MySQL 是否正在运行,但并没有运行。因此我尝试重新启动它 - 但出现错误
mysql status:
mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Mi 2017-10-18 20:08:06 CEST; 1min 26s ago
Docs: man:systemd-sysv-generator(8)
Process: 4640 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Okt 18 20:07:36 h273239.stratoserver.net mysqld[4815]: 171018 20:07:36 [Note] InnoDB: Shutdown completed; log sequence number 19026477
Okt 18 20:07:36 h273239.stratoserver.net mysqld[4815]: 171018 20:07:36 [Note] /usr/sbin/mysqld: Shutdown complete
Okt 18 20:07:36 h273239.stratoserver.net mysqld[4815]:
Okt 18 20:07:36 h273239.stratoserver.net mysqld_safe[4850]: mysqld from pid file /var/run/mysqld/mysqld.pid ended
Okt 18 20:08:06 h273239.stratoserver.net /etc/init.d/mysql[5123]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Okt 18 20:08:06 h273239.stratoserver.net /etc/init.d/mysql[5123]: [61B blob data]
Okt 18 20:08:06 h273239.stratoserver.net /etc/init.d/mysql[5123]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld /mysqld.sock' (111 "Connection refused")'
Okt 18 20:08:06 h273239.stratoserver.net /etc/init.d/mysql[5123]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Okt 18 20:08:06 h273239.stratoserver.net /etc/init.d/mysql[5123]:
Okt 18 20:08:06 h273239.stratoserver.net mysql[4640]: ...fail!
因为我们是一个小型非政府组织,所以我们无法支付专业帮助的费用 - 所以你们是我最后的选择 - 提前感谢!
答案1
尝试执行以下命令:
systemctl stop mysql.service; systemctl stop mysql.socket
killall mysqld
rm -f /var/run/mysqld/mysqld.sock
systemctl start mysql
这有什么改变吗?如果没有,请发布你的最后 100 行/var/log/messages
(带有tail -n 100
)