zoukankan      html  css  js  c++  java
  • mysql数据库提示ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    ①无提示无法通过/var/lib/mysql/mysql.sock连接数据库;
    [root@proeim mysql]# mysql -uxxx -pxxx -Dxxx -A
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2
    ②排查发现是因为该目录下缺少mysql.sock文件;
    ③通过软连接的形式来复制得到相关文件:
    cd /var/lib/mysql/
    ln -s /tmp/mysql.sock  mysql.sock
    ④查看mysql的状态:
    service mysqld-ib status
    MySQL is not running, but lock exists [FAILED]
    ⑤然后启动mysql:
    [root@proeim bin]# service mysqld-ib start
    Starting MySQL.. [ OK ]
     
    ⑥然后连接mysql,发现连接成功了:
     
    mysql -uxxx -pxxx -Dxxx -A
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 358878
    Server version: 5.1.40 build number (revision)=IB_4.0.7_r16961_17249(ice) (static)
    Copyright (c) 2000, 2011, 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>
     
  • 相关阅读:
    hdu 3018
    poj 1833 排列
    poj 1256 Anagram
    CF 548B Mike and Fun
    CF 548A
    【冰茶几专题】F
    【冰茶几专题】C
    535 C.Tavas and karafs
    [WA]cf 534 D. Handshakes
    cf 534C. Polycarpus' Dice
  • 原文地址:https://www.cnblogs.com/ddpeng/p/9577404.html
Copyright © 2011-2022 走看看