我需要Mariadb 10.1来满足我的要求。 每次我重新启动系统时都会出现以下错误。
ERROR 2002(HY000):无法通过socket' /var/run/mysqld/mysqld.sock'连接到本地MySQL服务器; (2"没有这样的文件或目录")
我尝试了一些在互联网上找到的解决方案,但似乎都没有工作
运行服务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文件错误。有没有解决方案。文件丢失是否有特定原因?
三江源。
答案 0 :(得分:0)
假设你已经启用了MySQL作为服务(看起来就是这种情况),那么我建议你做一个service mysql status
以查看该服务是否干净利落(如果没有它会给你看一些错误信息)。