首页 > 代码库 > Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'的解决

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'的解决

Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘的解决

原因是目录 的访问权限问题,ubuntu下用下面的命令(其他发行版用管理员权限,把sudo去掉)

sudo chown -R mysql:mysql /var/run/mysqld

然后启动服务器

sudo /etc/init.d/mysql start

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'的解决