How to fix

无法通过socket/var/run/mysqld/mysqld.sock连接到本地MySQL服务器。

当使用MySQL/MariaDB数据库时,您可以看到一个奇怪的错误: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) 日志文件中的相同错误: [ERROR] Can’t start server : Bind on unix socket: No such file or directory [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ? 在最简单的情况下,它将通过off/on的仪式来解决: sudo killall -9 mysqldsudo /etc/init.d/mysql start 或现代风格: sudo killall -9 mysqldsystemctl startContinue Reading