2013-06-04 170 views
11

我在几分钟前随机停止工作后开始启动MySQL时遇到问题。在试图连接我得到这个错误:亚马逊EC2 MySQL无法启动

Connect failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 

于是,我就重启MySQL(这不得不之前为我工作),我得到这个:

Stopping mysqld:           [ OK ] 
MySQL Daemon failed to start. 
Starting mysqld:           [FAILED] 

这里是我的错误日志:

130414 20:03:45 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
130414 20:03:45 [Note] Plugin 'FEDERATED' is disabled. 
130414 20:03:45 InnoDB: The InnoDB memory heap is disabled 
130414 20:03:45 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
130414 20:03:45 InnoDB: Compressed tables use zlib 1.2.5 
130414 20:03:45 InnoDB: Using Linux native AIO 
130414 20:03:45 InnoDB: Initializing buffer pool, size = 128.0M 
130414 20:03:45 InnoDB: Completed initialization of buffer pool 
InnoDB: The first specified data file ./ibdata1 did not exist: 
InnoDB: a new database to be created! 
130414 20:03:45 InnoDB: Setting file ./ibdata1 size to 10 MB 
InnoDB: Database physically writes the file full: wait... 
130414 20:03:46 InnoDB: Log file ./ib_logfile0 did not exist: new to be created 
InnoDB: Setting log file ./ib_logfile0 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
130414 20:03:46 InnoDB: Log file ./ib_logfile1 did not exist: new to be created 
InnoDB: Setting log file ./ib_logfile1 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
InnoDB: Doublewrite buffer not found: creating new 
InnoDB: Doublewrite buffer created 
InnoDB: 127 rollback segment(s) active. 
InnoDB: Creating foreign key constraint system tables 

任何人都可以提供一些提示吗?我很不喜欢这个服务器的东西:P

非常感谢!

+0

日志条目似乎从4月14日初次初始化时开始。这是整个日志吗?还要确保你没有用'df'检查磁盘空间不足。 – datasage

回答

14

我通过重新启动EC2实例解决了这个问题。

+0

+1非常感谢你@goddfree我有一个类似的问题,让我回来了几个小时 - 看到我的问题在这里:http://wordpress.stackexchange.com/questions/110746/error-establishing-a-database-connection- mysql-error-2002-aws-ec2-outage – Anthony

+0

我很高兴这有助于别人。我深入探究了这个问题,并被告知实质上MySQL数据库崩溃了,因为我使用的EC2实例没有足够的处理能力来处理我正在执行的查询。 – Charles

+0

谢谢,我有同样的问题,我重新启动ec2实例,但由于某种原因,MySQL服务器本身并没有启动,奇怪,我不得不手动启动它,它解决了我的问题...感谢分享这个答案,我从来没有想过重新启动ec2实例:)最好的问候。 –

0

我有这个问题太上的EC2实例微型我上运行WordPress的。原来,Apache是​​一个内存猪,这是不允许mysqld启动/重新启动。一旦我编辑httpd.conf来驯服apache的内存使用,httpd就没有问题了。

1

在我的情况下,我通过清除服务器中的一些空间来解决它。

我每天都在进行数据库备份,导致消耗大量空间。 我删除了所有这些备份并启动了mysql。

0

我在多个AWS服务器上多次看到这个问题,在我的案例中主要的根本原因是缺乏空间。我从服务器中删除了一些未使用的文件,这些文件占用了空间并且问题得到解决。

这个缺乏空间的问题也会阻止你的apache运行。