Mysql 无明显原因停止

Mysql 无明显原因停止

连续第三天,我发现我的网站瘫痪了。原因:mysql 没有运行。执行 sudo mysql restart — 一切又恢复正常(几个小时)。但 mysql 到底为什么会停止运行呢?

以下是日志的最后几行:

              482 Connect   zslon_sweetbread@localhost on zslon_sweetbread
              482 Query     SET NAMES 'utf8'
              482 Query     DESCRIBE `cms_model_image`
              482 Query     SELECT `cms_model_image`.* FROM `cms_model_image` WHERE (((`cms_model_image`.`id` = 962)))
              483 Connect   zslon_sweetbread@localhost on zslon_sweetbread
              483 Query     SET NAMES 'utf8'
              483 Query     DESCRIBE `cms_model_image`
              483 Query     SELECT `cms_model_image`.* FROM `cms_model_image` WHERE (((`cms_model_image`.`id` = 958)))
130211 16:51:31   482 Quit
                  483 Quit
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
/usr/sbin/mysqld, Version: 5.5.28-0ubuntu0.12.04.3-log ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument

无法理解... 常规查询,但不知为何会重复“/usr/sbin/mysqld,版本:5.5.28-0ubuntu0.12.04.3-log ((Ubuntu))。启动于:Tcp 端口:3306 Unix 套接字:/var/run/mysqld/mysqld.sock”。这是什么?这是尝试重新启动还是什么?如果我执行“sudo service mysql restart”,它就可以正常工作。原因是什么,如何修复?

答案1

从您发布的症状来看,我认为 /var 中的磁盘空间不足

如果不是这种情况,请为 MySQL 服务器启用核心转储。在启动服务器之前,运行:

ulimit -c unlimited

然后在崩溃后,搜索名为“core”的文件。然后您可以运行 gdb 回溯来查看崩溃时的堆栈。

相关内容