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

后端 未结 30 2289
再見小時候
再見小時候 2020-11-22 04:23

I am having a big problem trying to connect to mysql. When I run:

/usr/local/mysql/bin/mysql start

I have the following error :

<         


        
30条回答
  •  有刺的猬
    2020-11-22 04:41

    If you are using AWS (Amazon Web Services) Micro version, then it is a memory issue. When I ran

    mysql
    

    from the terminal it would say

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

    So I tried the following and it would just fail.

    service mysqld restart
    

    After much searching, I found out that you have to create a swap file for MySQL to have enough memory. Instructions are listed: http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html.

    Then, I was able to restart mysqld.

提交回复
热议问题