Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)解决方法

问题:正常启动mysql,显示成功,查看状态报错 .并且不能连接

查看启动日志,发现是内存不够启动(低配云服务器)

解决方案:

  1.停掉一些不使用的进程释放内存

  2.在/var/lib/mysql/下创建一个空的   mysql.pid 文件

   [[email protected] mysql]# echo >> chendu.pid

  3.重新启动

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)解决方法

原文地址:https://www.cnblogs.com/hamlin/p/10727311.html

时间: 2024-11-08 23:38:21

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)解决方法的相关文章

Can't connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘ (2)解决思路

首先说明一下mysql.sock文件的作用: 连接mysql有两种方式,第一种是TCP/IP,第二种就是直接使用unix domain socket,它比TCP/IP块. mysql.sock是在mysql-server和client在同一服务器上时,发起本地连接时可用,而无需定义-h参数指定具体的IP.mysql.sock是随每次mysql server启动时生成,通常配置参数是将mysql.sock生成在/tmp/目录下.即在/etc/my.cnf文件中指定socket=/tmp/mysql

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 th

解决mysql报错Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

启动mysql 报错: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 1.先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.另外看看是不是权限问题. 2.确定你的mysql.sock是不是在那个位置,mysql -u 你的mysql用户名 -p -S /var/lib/mysql/

mysql Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

错误原因:/var/lib/mysql目录中socket文件不存在.连接mysql服务器有两种方式:tcp连接,通过socket文件连接.通过socket文件,启动mysql服务,mysql服务会自动生成一个sock文件,生成的sock文件默认放在 --datadir=/var/lib/mysql,mysql默认从/var/lib/mysql目录读取sock文件. 解决办法:1.看看/var/lib/mysql/mysql 有没有mysql.sock文件2.没有mysql.sock,重启mysq

(MYSQL)ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 方案1. 1.#ps -A|grep mysql 显示类似: 1829 ?        00:00:00 mysqld_safe   1876 ?        00:00:31 mysqld 2.#kill -9 1829 3.#kill -9 1876 4.#/etc/init.d/

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

在Centos系统输入mysql回车出现以下错误的解决方法: MYSQL错误:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 解决方法一: 如果是以yum方法安装: 直接service mysqld start启动后 再输入mysql命令可进入mysql数据库 Can't connect to local MySQL server thro

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib

今天在linux里安装mysql,运行时遇到这样的错误 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' 上网查了下: 这种情况大多数是因为你的mysql是使用rpm方式安装的,它会自动寻找 /var/lib/mysql/mysql.sock 这个文件,通过unix socket登录mysql.常见解决办法如下:1.创建/修改文件 /etc/my.c

服务器数据库挂掉 Can 't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '(2) ";

刚刚遇到这个报错,我无语了,我这么个菜逼,咋解决,还好师兄(付付)解决了,付付真棒,在此记录一下,以供学习 Can 't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '(2) "; 1.查日志(首先还是看error.log),我看了一遍,继续急,师兄看了一遍 2. can't create /write to file 'tmp'  ,fk,就是/tmp的权限问题,害我干着急 3.报这个错误的原因

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

今天mysql不知道犯啥病,root登录的时候一直报这个错误. 在国内网站找了找,没什么合适的 答案,在stackoverflow和ubuntu的一个社区上找到了答案,搞定了,但是没太看懂,记录一下,以后再翻. That said, Here is what I did/ found out: 1. You don't have to change the tmp directory in the my.cnf file. Even adding a second directory, chan

error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'

[[email protected] ~]#   /usr/bin/mysqladmin -u root password 'aaaaaa' /usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' Check that mysqld is runni