Mysql无法通过Amazon EC2上的套接字连接到本地服务器 [英] Mysql can't connect to local server through socket on Amazon EC2

查看:116
本文介绍了Mysql无法通过Amazon EC2上的套接字连接到本地服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Amazon EC2上打开了我的应用程序(在Rails中)并收到错误-因此我检查了日志,并显示以下内容:

I opened my application (in Rails) on Amazon EC2 and got an error - thus I checked the logs and there is following:

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

10个小时前一切正常.有什么问题?流量大吗? 该应用程序正在Micro Instance上运行.

10 hours ago was everything working yet. What's the problem? A lot of traffic? The app is running on Micro Instance.

如何解决此问题以及将来如何避免它?

How to fix this issue and how to avoid it in the future?

非常感谢您

sudo find / -type s
---
/tmp/.sock
/dev/log
/var/lib/apt-xapian-index/update-socket
/run/mysqld/mysqld.sock
/run/acpid.socket
/run/dbus/system_bus_socket
/run/udev/control
find: `/proc/4739/task/4739/fd/5': No such file or directory
find: `/proc/4739/task/4739/fdinfo/5': No such file or directory
find: `/proc/4739/fd/5': No such file or directory
find: `/proc/4739/fdinfo/5': No such file or directory

推荐答案

在我的情况下,服务器显然已在某个时间点重新启动,而mysql在启动时并未启动.我只是键入要启动的命令就可以了:

In my case, the server had apparently restarted at some point, and mysql was not started when it did. I simply typed the command to start and it worked:

sudo service mysqld start

这篇关于Mysql无法通过Amazon EC2上的套接字连接到本地服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆