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


    部署mysql版本信息
    version: 5.6.21
    具体现象:
    mysql服务能够正常启动如下:
    [root@localhost ~]# service mysqld restart
    Shutting down MySQL.. SUCCESS! 
    Starting MySQL.. SUCCESS! 
    登陆mysql库出现如下错误:
    [root@localhost ~]# mysql
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    解决方法:
    经过对如上错误分析,/var/lib/mysql/目录下缺少mysql.sock(mysql的套字节)
    [root@localhost ~]# find / -name mysql.sock
    /tmp/mysql.sock
    只要系统中存在mysql.sock这个文件,接下来解决问题就会很好办如下操作:
    [root@localhost ~]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
    重启服务
    [root@localhost ~]# service mysqld restart
    Shutting down MySQL.. SUCCESS! 
    Starting MySQL.. SUCCESS! 
    重新登陆
    [root@localhost ~]# mysql
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 2
    Server version: 5.6.21 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> 
    

      

  • 相关阅读:
    基本数据类型转换
    java8新增的日期时间包
    算法之冒泡排序
    基本数据类型
    spring入门
    JiuDuOj——1020
    JiuDuOj——1051
    2015.11.26——Accelerated C++
    POJ2681——求字符串长度
    POJ1017——装箱问题
  • 原文地址:https://www.cnblogs.com/qlwang/p/4260032.html
Copyright © 2020-2023  润新知