gpt4 book ai didi

mysql - Mariadb 10.1,每次系统重启时mysqld.sock文件丢失

转载 作者:行者123 更新时间:2023-11-29 18:01:37 25 4
gpt4 key购买 nike

我需要 Mariadb 10.1 来满足我的要求。每次我重新启动系统时,我都会收到以下错误。

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

我尝试了在互联网上找到的几个解决方案,但似乎都不起作用

  • 尝试手动创建所有者为 mysql 的 sock 文件。
  • 尝试重新启动/启动 mysql 服务器,但出现错误。

运行服务mysql状态

mariadb.service - MariaDB 10.1.30 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: timeout) since Wed 2018-01-17 11:09:45 IST; 3min 43s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1143 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 982 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemc
Process: 974 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 967 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 1143 (code=exited, status=0/SUCCESS)

Jan 17 11:09:42 infibeam-vostro-006 mysqld[1143]: 2018-01-17 11:09:42 140110739585792 [Note] /usr/sbin/mysqld: Normal shutdown
Jan 17 11:09:42 infibeam-vostro-006 mysqld[1143]: 2018-01-17 11:09:42 140110739585792 [Note] Event Scheduler: Purging the queue. 0 events
Jan 17 11:09:43 infibeam-vostro-006 mysqld[1143]: 2018-01-17 11:09:43 140109819123456 [Note] InnoDB: FTS optimize thread exiting.
Jan 17 11:09:43 infibeam-vostro-006 mysqld[1143]: 2018-01-17 11:09:43 140110739585792 [Note] InnoDB: Starting shutdown...
Jan 17 11:09:43 infibeam-vostro-006 mysqld[1143]: 2018-01-17 11:09:43 140110739585792 [Note] InnoDB: Waiting for page_cleaner to finish flushin
Jan 17 11:09:45 infibeam-vostro-006 mysqld[1143]: 2018-01-17 11:09:45 140110739585792 [Note] InnoDB: Shutdown completed; log sequence number 82
Jan 17 11:09:45 infibeam-vostro-006 mysqld[1143]: 2018-01-17 11:09:45 140110739585792 [Note] /usr/sbin/mysqld: Shutdown complete
Jan 17 11:09:45 infibeam-vostro-006 systemd[1]: Failed to start MariaDB 10.1.30 database server.
Jan 17 11:09:45 infibeam-vostro-006 systemd[1]: mariadb.service: Unit entered failed state.
Jan 17 11:09:45 infibeam-vostro-006 systemd[1]: mariadb.service: Failed with result 'timeout'

唯一有效的解决方案是从系统中清除 mysql 并重新安装它。我就是这样做的。

sudo apt-get --purge remove "mysql*"
sudo apt update -y
sudo apt install -y mariadb-server
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

但是下次启动系统时,它给出了同样的错误,sock 文件丢失。有没有办法解决这个问题。文件丢失有什么具体原因吗?

谢谢。

最佳答案

假设您已启用 MySQL 作为服务(看起来确实如此),那么我建议您执行 service mysql status 来查看该服务是否已正常启动(如果它不会向您显示一些错误消息)。

关于mysql - Mariadb 10.1,每次系统重启时mysqld.sock文件丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48275204/

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