登陆mysql的时候,出现了这个问题: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

解决办法:

1、先删除mysql.sock

cd /var/lib/mysql
mv  mysql.sock  mysql.sock.bak

2、再次登陆

mysql -uroot -p123456

会出现下面的问题:

报了:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)的错。

3、看看mysql的状态,另外看看是不是mysql的权限问题

很明显,不是权限问题。

4、启动

/etc/init.d/mysqld start

问题解决,在var/lib/mysql下会出现mysql.sock。

转载:https://www.cnblogs.com/invban/p/5824796.html

【搬运工】 Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'的更多相关文章

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

    有时候,当我们使用"mysql"."mysqladmin"."mysqldump"等命令管理数据库时,服务器抛出类似如下错误: 一.错误现场 ...

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

    从供应商手中接手一个云平台(Windwos Azure)上的MySQL数据库,登录数据库时遇到错误: $mysql -uroot -p Enter password: ERROR 2002 (HY00 ...

  3. mac ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib /mysql/mysql.sock' (111)

    之前装了mysql,今天打开mysql的时候报了个Can't connect to local MySQL server through socket '/var/lib /mysql/mysql.s ...

  4. 更换mysql数据目录后出现ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 的解决办法

    服务器上的mysql默认数据目录为/var/lib/mysql/,同时服务器的/空间不是很大,而近期又有大量的日志需要导入进行分析,时常搞得/的空间捉襟见肘,晚上一狠心就想把mysql的数据目录转移到 ...

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

    安装上mysql后,报 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock',试了网上的方法 ...

  6. 启动mysql错误ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ ( ...

  7. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)--MySQL错误

    MySQL错误整理: 错误一: ERROR (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/my ...

  8. Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’解决方法 + Linux启动/停止/重启Mysql数据库的方法

    启动mysql 报错: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/m ...

  9. 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) ; 如果你在网上search这个 ...

随机推荐

  1. springcloud第四步:ribbon搭建服务负载均衡

    使用ribbon实现负载均衡 启动两个会员服务工程,端口号分别为8762.8763,订单服务 使用负载均衡策略轮训到会员服务接口. 什么是ribbon ribbon是一个负载均衡客户端 类似nginx ...

  2. SpringBoot项目修改html后不即时编译

    springboot templates 下的 html 修改后无法达到即时编译的效果,搜索资料后记录笔记.原文地址:https://www.cnblogs.com/jiangbei/p/843939 ...

  3. MessengerJS

    跨文档通信解决方案 Since modern browsers have native cross-document communication method(the PostMeessage API ...

  4. 输入参数的默认值设定${3:-var_d}

    今天看到一个不一样的写法: if [ $# != 2 ] && [ $# != 3 ] ; then #判断参数个数    echo "Invalid Args"  ...

  5. canal 代码阅读

    涉及到有边界队列,无边界队列.poolSize.corePoolSize.maximumPoolSize 三者参数含义 If there are more than corePoolSize but ...

  6. xamarin.Android开发前的配置

    vs2019开发 入门教程 https://docs.microsoft.com/zh-cn/xamarin/android/get-started/installation/android-emul ...

  7. 纯JS.CSS编写的可拖拽并左右分栏的插件(复制代码就能用)

    <!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equ ...

  8. 自定义Win10右键“发送到”菜单

    打开Win10文件资源管理器窗口(打开“这台电脑”或任一文件夹即可),然后在资源管理器窗口的地址栏中输入 shell:sendto ,回车或点击地址栏右侧的“转到”箭头即可打开“SendTo(发送到) ...

  9. lnmp 安装opencart出现open_basedir 错误解决办法

    php 在引用上级目录以外的文件时报错可以通过设置/usr/local/nginx/conf/fastcgi.conf

  10. 大数据处理框架之Strom:DRPC

    环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 jdk1.8 storm-0.9 一.DRPC DRPC:Distri ...