zoukankan      html  css  js  c++  java
  • mysql之ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'解决方法

    LAMPP安装完成之后,mysql -u root -p连不上,报这个错误:

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

    在mysql的配置文件里,/opt/lampp/etc/my.cnf, 发现了这样的配置:

    [java]
    <SPAN style="FONT-SIZE: 24px"># The following options will be passed to all MySQL clients 
    [client] 
    #password       = your_password 
    port            = 3306 
    socket          = /opt/lampp/var/mysql/mysql.sock 
     
    # Here follows entries for some specific programs 
     
    # The MySQL server 
    [mysqld] 
    user            = nobody 
    port            = 3306 
    socket          = /opt/lampp/var/mysql/mysql.sock 
     
    </SPAN> 

    # The following options will be passed to all MySQL clients
    [client]
    #password       = your_password
    port            = 3306
    socket          = /opt/lampp/var/mysql/mysql.sock

    # Here follows entries for some specific programs

    # The MySQL server
    [mysqld]
    user            = nobody
    port            = 3306
    socket          = /opt/lampp/var/mysql/mysql.sock

    原来mysql用的套接字文件是:/opt/lampp/var/mysql/mysql.sock

    于是建立了个软连接:

    ln -s /opt/lampp/var/mysql/mysql.sock  /var/run/mysqld/mysqld.sock(如果mysqld目录不存在,可以用mkdir新建一个!)

    现在就可以用mysql -u root -p 命令登陆上了~

  • 相关阅读:
    Python:文件操作技巧(File operation)
    使用多域名实现并行下载
    win7 + cygwin + nodejs很详细的安装步骤【推荐】
    gzip压缩
    C#中一些常用的方法使用
    C#中的@符号的使用
    Sql中partition by的使用
    C#中使用WCF一些常见问题及解决方案
    C# MVC中直接执行Js
    MVC路由规则进一步了解
  • 原文地址:https://www.cnblogs.com/milantgh/p/4290206.html
Copyright © 2011-2022 走看看