mysqld 由于表损坏(磁盘已满 + 硬件重启)在启动后立即停止 - 如何修复?

mysqld 由于表损坏(磁盘已满 + 硬件重启)在启动后立即停止 - 如何修复?

我很笨,我做了最愚蠢的事。我的一台服务器上的 SSD 已满,而我却没有意识到这一点。

高流量的网站运行起来非常慢,然后开始显示错误,因为数据库甚至无法保存新行。

在我弄清楚发生了什么之前,我进行了硬重启。然后 mysqld 服务无法启动。

我开始删除一些不重要的文件(结果发现 80% 的空间都是垃圾),所以现在我有 80% 的可用空间。

不幸的是,每次我尝试运行“service mysqld restart”或启动时,它都会启动然后立即停止。

我的配置: - Debian 7.5 + DirectAdmin(Apache,MySQL), - 数据库非常庞大,包括 MyISAM 和 InnoDB 表。

我尝试进行导出,但如果 mysqld 服务不运行,则无法运行 mysqldump。

我从 /usr/local/mysql/data 复制了我的表,并且也有一个备份,但是是 SQL 格式的 - 所以我无法导入它。但最好的选择是运行当前表,因为备份是旧的。

我到目前为止已经尝试过:

  • myisamchk -r -v *.MYI
  • 设置“innodb_force_recovery=3”(我首先尝试了 1 和 2)
  • 多次硬重启和所有服务重启
  • 更改损坏的数据库文件夹的名称,但我在日志中看到错误(找不到表格文件等)

MySQL 日志没有解释任何内容:

150813 15:48:13 mysqld_safe mysqld from pid file /usr/local/mysql/data/ns390143.pid ended
150813 15:48:21 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2015-08-13 15:48:21 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-08-13 15:48:21 2954 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
2015-08-13 15:48:21 2954 [Note] Plugin 'FEDERATED' is disabled.
2015-08-13 15:48:21 2954 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-13 15:48:21 2954 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-13 15:48:21 2954 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-13 15:48:21 2954 [Note] InnoDB: Using Linux native AIO
2015-08-13 15:48:21 2954 [Note] InnoDB: Using CPU crc32 instructions
2015-08-13 15:48:21 2954 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-13 15:48:21 2954 [Note] InnoDB: Completed initialization of buffer pool
2015-08-13 15:48:21 2954 [Note] InnoDB: Highest supported file format is Barracuda.
2015-08-13 15:48:21 2954 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-13 15:48:21 2954 [Note] InnoDB: Waiting for purge to start
2015-08-13 15:48:21 2954 [Note] InnoDB: 5.6.12 started; log sequence number 28646291749
2015-08-13 15:48:21 2954 [ERROR] Aborting

2015-08-13 15:48:21 2954 [Note] Binlog end
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'partition'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'ARCHIVE'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_METRICS'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_CMPMEM'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_CMP'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_LOCKS'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'INNODB_TRX'
2015-08-13 15:48:21 2954 [Note] Shutting down plugin 'InnoDB'
2015-08-13 15:48:21 2954 [Note] InnoDB: FTS optimize thread exiting.
2015-08-13 15:48:21 2954 [Note] InnoDB: Starting shutdown...
2015-08-13 15:48:23 2954 [Note] InnoDB: Shutdown completed; log sequence number 28646291759
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'BLACKHOLE'
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'CSV'
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'MRG_MYISAM'
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'MyISAM'
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'MEMORY'
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'sha256_password'
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'mysql_old_password'
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'mysql_native_password'
2015-08-13 15:48:23 2954 [Note] Shutting down plugin 'binlog'
2015-08-13 15:48:23 2954 [Note]

我的问题是:

  1. 如何修复?有可能吗?

  2. 如果没有,我该如何导入.sql文件备份?

答案1

解决了!

这是配置错误。

Directadmin my.conf 中 MYSQL 套接字的正确路径是:/tmp/mysql.sock

绑定地址也是:127.0.0.1

现已开始工作!

答案2

该文件不存在,我没有更改配置,所以应该没问题。我之前在 Google 上搜索过这个主题,并尝试从“English”目录复制此文件,但并没有解决任何问题,只是错误消息消失了。

现在我尝试将目录添加到配置文件中并且它启动了,但是网站仍然无法启动并且 phpMyAdmin 抛出“#2002 - 没有这样的文件或目录。服务器没有响应(或者本地服务器的套接字配置不正确)。”。

但至少我能够从 mysqldump 进行备份!

当前日志:

150813 16:41:34 mysqld_safe mysqld from pid file /usr/local/mysql/data/ns390143.pid ended
150813 16:41:37 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2015-08-13 16:41:38 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-08-13 16:41:38 20975 [Note] Plugin 'FEDERATED' is disabled.
2015-08-13 16:41:38 20975 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-13 16:41:38 20975 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-13 16:41:38 20975 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-13 16:41:38 20975 [Note] InnoDB: Using Linux native AIO
2015-08-13 16:41:38 20975 [Note] InnoDB: Using CPU crc32 instructions
2015-08-13 16:41:38 20975 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-13 16:41:38 20975 [Note] InnoDB: Completed initialization of buffer pool
2015-08-13 16:41:38 20975 [Note] InnoDB: Highest supported file format is Barracuda.
2015-08-13 16:41:38 20975 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-13 16:41:38 20975 [Note] InnoDB: Waiting for purge to start
2015-08-13 16:41:38 20975 [Note] InnoDB: 5.6.12 started; log sequence number 28646292851
2015-08-13 16:41:38 20975 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2015-08-13 16:41:38 20975 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
2015-08-13 16:41:38 20975 [Note] Server socket created on IP: '127.0.0.1'.
2015-08-13 16:41:38 20975 [Note] Event Scheduler: Loaded 0 events
2015-08-13 16:41:38 20975 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.6.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Source distribution
20975

如果它仍然只能部分工作,现在该怎么办?

相关内容