bitsCN.com
解决mysql登陆时出现“ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)”
mariadb同样适用
首先检查mysql状态
linux-6yo1:~ # /etc/init.d/mysql statusChecking for service MySQL: unusedmysql.service - LSB: Start the MySQL database server Loaded: loaded (/etc/init.d/mysql) Active: inactive (dead) CGroup: name=systemd:/system/mysql.serviceJul 17 15:28:28 linux-6yo1.site systemd[1]: Stopped LSB: Start the MySQL dat....Jul 17 15:30:38 linux-6yo1.site systemd[1]: Stopped LSB: Start the MySQL dat....
发现Active: inactive (dead)
重启mysql.
linux-6yo1:~ # /etc/init.d/mysql restartredirecting to systemctl restart mysql
再次查看mysql状态
linux-6yo1:~ # ps aux | grep mysqlroot 5227 0.5 0.1 3204 1320 ? S 15:39 0:00 /bin/sh /usr/bin/mysqld_safe --mysqld=mysqld --user=mysql --pid-file=/var/run/mysql/mysqld.pid --socket=/var/