我刚刚删除了 /tmp/ 中的一个文件夹,现在 apache/mysql 出现错误。发生了什么?

我刚刚删除了 /tmp/ 中的一个文件夹,现在 apache/mysql 出现错误。发生了什么?

所以我刚刚删除了我的 ubuntu 服务器 (12.10) 上的 /tmp/ 中的一个文件夹和一个文件。现在与 MySQL 相关的一切都有问题。我创建的 root mysql 帐户似乎也已重置。尝试使用 PHPMyadmin 登录时:

您的配置中定义的控制用户的连接失败。

使用 SSH(putty)输入“MySQL”时

错误 2002 (HY000):无法通过套接字“/var/run/mysqld/mysqld.sock”连接到本地 MySQL 服务器 (2)

刚刚发生了什么?我该如何解决?

另外,我刚刚检查了状态,它处于离线状态。不会重新启动。Job failed.

刚刚重新启动了服务器以及 mysql。

stop: Unknown instance: start: Job failed to start


130219 22:17:42 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
130219 22:18:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130219 22:18:01 [Note] Plugin 'FEDERATED' is disabled.
130219 22:18:01 InnoDB: The InnoDB memory heap is disabled
130219 22:18:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130219 22:18:01 InnoDB: Compressed tables use zlib 1.2.7
130219 22:18:01 InnoDB: Using Linux native AIO
130219 22:18:01 InnoDB: Initializing buffer pool, size = 128.0M
130219 22:18:01 InnoDB: Completed initialization of buffer pool
130219 22:18:01 InnoDB: highest supported file format is Barracuda.
130219 22:18:01 InnoDB: Waiting for the background threads to start
130219 22:18:02 InnoDB: 1.1.8 started; log sequence number 69234959 /usr/sbin/mysqld: Too many arguments (first extra is 'restart'). Use --verbose --help to get a list of available options
130219 22:18:02 [ERROR] Aborting

我正在使用 Ubuntu Server。

当尝试使用sudo /etc/init.d/mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop mysql ; start mysql. The restart(8) utility is also available.
start: Job failed to start

MySQL 错误日志:

130220  8:15:54 [Note] Plugin 'FEDERATED' is disabled.
130220  8:15:54 InnoDB: The InnoDB memory heap is disabled
130220  8:15:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130220  8:15:54 InnoDB: Compressed tables use zlib 1.2.7
130220  8:15:54 InnoDB: Using Linux native AIO
130220  8:15:54 InnoDB: Initializing buffer pool, size = 128.0M
130220  8:15:54 InnoDB: Completed initialization of buffer pool
130220  8:15:54 InnoDB: highest supported file format is Barracuda.
130220  8:15:54  InnoDB: Waiting for the background threads to start
130220  8:15:55 InnoDB: 1.1.8 started; log sequence number 69234959
130220  8:15:55 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3305
130220  8:15:55 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
130220  8:15:55 [Note] Server socket created on IP: '127.0.0.1'.
130220  8:15:55 [Note] Event Scheduler: Loaded 0 events
130220  8:15:55 [Note] mysqld: ready for connections.
Version: '5.5.29-0ubuntu0.12.10.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3305  (Ubuntu)
130220  8:16:16 [ERROR] mysqld: Table './site_forum/mybb_datacache' is marked as crashed and should be repaired
130220  8:16:16 [Warning] Checking table:   './site_forum/mybb_datacache'
130220  8:16:16 [ERROR] mysqld: Table './site_forum/mybb_themes' is marked as crashed and should be repaired
130220  8:16:16 [Warning] Checking table:   './site_forum/mybb_themes'
130220  8:16:16 [ERROR] mysqld: Table './site_forum/mybb_templates' is marked as crashed and should be repaired
130220  8:16:16 [Warning] Checking table:   './site_forum/mybb_templates'
130220  8:16:16 [ERROR] mysqld: Table './site_forum/mybb_forums' is marked as crashed and should be repaired
130220  8:16:16 [Warning] Checking table:   './site_forum/mybb_forums'
130220  8:16:16 [ERROR] mysqld: Table './site_forum/mybb_threads' is marked as crashed and should be repaired
130220  8:16:16 [Warning] Checking table:   './site_forum/mybb_threads'
130220  8:16:16 [ERROR] mysqld: Table './site_forum/mybb_posts' is marked as crashed and should be repaired
130220  8:16:16 [Warning] Checking table:   './site_forum/mybb_posts'
130220  8:16:16 [ERROR] Got an error from unknown thread, /build/buildd/mysql-5.5-5.5.29/storage/myisam/ha_myisam.cc:912
130220  8:16:16 [Warning] Recovering table: './site_forum/mybb_posts'
130220  8:16:16 [Note] Retrying repair of: './site_forum/mybb_posts' with keycache
130220  8:16:16 [ERROR] mysqld: Disk is full writing './site_forum/mybb_posts.TMD' (Errcode: 28). Waiting for someone to free space... (Expect up to 60 secs delay for server to continue after freeing disk space)
130220  8:16:16 [ERROR] mysqld: Retry in 60 secs. Message reprinted in 600 secs
130220  8:16:51 [ERROR] mysqld: Table './site_forum/mybb_spiders' is marked as crashed and should be repaired
130220  8:16:51 [Warning] Checking table:   './site_forum/mybb_spiders'
130220  8:16:51 [ERROR] mysqld: Table './site_forum/mybb_sessions' is marked as crashed and should be repaired
130220  8:16:51 [Warning] Checking table:   './site_forum/mybb_sessions'
130220  8:18:40 [ERROR] mysqld: Table './site_forum/mybb_users' is marked as crashed and should be repaired
130220  8:18:40 [Warning] Checking table:   './site_forum/mybb_users'
130220  8:18:40 [ERROR] mysqld: Table './site_forum/mybb_userfields' is marked as crashed and should be repaired
130220  8:18:40 [Warning] Checking table:   './site_forum/mybb_userfields'
130220  8:18:40 [ERROR] mysqld: Table './site_forum/mybb_privatemessages' is marked as crashed and should be repaired
130220  8:18:40 [Warning] Checking table:   './site_forum/mybb_privatemessages'

Status information:

Current dir: /var/lib/mysql/
Running threads: 21  Stack size: 196608
Current locks:
lock: 0x7f50c80229c0:

lock: 0x7f50c801fd20:

lock: 0x7f50c80183a0:

lock: 0x7f50e0009c10:

lock: 0x7f50e4010160:

lock: 0x7f50e400b490:

lock: 0x7f50f0028930:

lock: 0x7f50f00235e0:

lock: 0x7f50f0037320:

lock: 0x7f50f001dcc0:

lock: 0x7f50f0002de0:

lock: 0x7f50f0015270:

lock: 0x7f50ec0866b0:

lock: 0x7f50ec02d690:

lock: 0x7f50ec02bb90:

lock: 0x7f50ec0105a0:

DF-H

Filesystem      Size  Used Avail Use% Mounted on
rootfs           20G   19G     0 100% /
/dev/root        20G   19G     0 100% /
none            3.2G  280K  3.2G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none             16G     0   16G   0% /run/shm
none            100M     0  100M   0% /run/user
overflow        1.0M  8.0K 1016K   1% /tmp
/dev/md3         92G   20G   68G  23% /home

答案1

答案就在错误日志本身中:

130220 8:16:16 [错误] mysqld:写入“./site_forum/mybb_posts.TMD”时磁盘已满(错误代码:28)。正在等待某人释放空间……(释放磁盘空间后,服务器最多需要 60 秒才能继续运行)

$ perror 28
OS error code  28:  No space left on device

我建议你安装北卡罗莱纳大学,然后运行ncdu /查找大文件/文件夹并删除它们。


DF-H

Filesystem      Size  Used Avail Use% Mounted on
rootfs           20G   19G     0 100% /
/dev/root        20G   19G     0 100% /
none            3.2G  280K  3.2G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none             16G     0   16G   0% /run/shm
none            100M     0  100M   0% /run/user
overflow        1.0M  8.0K 1016K   1% /tmp
/dev/md3         92G   20G   68G  23% /home

/home好的。通过运行以下命令将数据目录移动到:

sudo mv /var/lib/mysql /home

不要忘记更改新文件夹的所有者:

sudo chown -R mysql:mysql /home/mysql

然后创建一个符号链接以便不必datadir更改my.cnf

sudo ln -s /home/mysql/ /var/lib/mysql

现在尝试启动 MySQL 看看它是否正常工作。

答案2

我不认为你删除了任何 SQL 文件,它们不应该在/tmp

我假设您删除了用于与 MySQL 服务器通信的套接字文件。

尝试重新启动 mysql 并查看它是否重新创建它,包括该文件夹。

否则,请尝试手动重新创建文件夹并在其上设置开放权限,然后chmod 777 <folder>重新启动 MySQL。

相关内容