mysql - MySQL,错误 126: 表的密钥文件不正确

  显示原文与译文双语对照的内容
0 0

我阅读以下问题具有相关性,但回复没有satify我: MySQL: #126不正确,版本,


这个问题

运行查询时收到此错误

errOR 126 ( HY000 ) : 不正确的密钥文件table`

这个问题

当我试图寻找问题我cantt找一只,所以我不知道如何修复它与修复命令。 有没有指针要怎样来找到问题导致此问题以任何其他方式那我已经尝试过?


" Query

mysql>       SELECT
    ->         Process.processId,
    ->         Domain.id AS domainId,
    ->         Domain.host,
    ->         Process.started,
    ->         COUNT(DISTINCT Joppli.id) AS countedObjects,
    ->         COUNT(DISTINCT Page.id)   AS countedPages,
    ->         COUNT(DISTINCT Rule.id)   AS countedRules
    ->       FROM Domain
    ->         JOIN CustomScrapingRule
    ->           AS Rule
    ->           ON Rule.Domain_id = Domain.id
    ->           LEFT JOIN StructuredData_Joppli
    ->             AS Joppli
    ->             ON Joppli.CustomScrapingRule_id = Rule.id
    ->         LEFT JOIN Domain_Page
    ->           AS Page
    ->           ON Page.Domain_id = Domain.id
    ->         LEFT JOIN Domain_Process
    ->           AS Process
    ->           ON Process.Domain_id = Domain.id
    ->       WHERE Rule.CustomScrapingRule_id IS NULL
    ->       GROUP BY Domain.id
    ->       ORDER BY Domain.host;
ERROR 126 (HY000): Incorrect key file for table '/tmp/#sql_2b5_4.MYI'; try to repair it

mysqlcheck

root@scraper:~# mysqlcheck -p scraper
Enter password: 
scraper.CustomScrapingRule                         OK
scraper.Domain                                     OK
scraper.Domain_Page                                OK
scraper.Domain_Page_Rank                           OK
scraper.Domain_Process                             OK
scraper.Log                                        OK
scraper.StructuredData_Joppli                      OK
scraper.StructuredData_Joppli_Product              OK

行计数

mysql> select count(*) from CustomScrapingRule;
+----------+
| count(*) |
+----------+
|       26 |
+----------+
1 row in set (0.04 sec)
mysql> select count(*) from Domain;
+----------+
| count(*) |
+----------+
|        2 |
+----------+
1 row in set (0.01 sec)
mysql> select count(*) from Domain_Page;
+----------+
| count(*) |
+----------+
|   134288 |
+----------+
1 row in set (0.17 sec)
mysql> select count(*) from Domain_Page_Rank;
+----------+
| count(*) |
+----------+
|  4671111 |
+----------+
1 row in set (11.69 sec)
mysql> select count(*) from Domain_Process;
+----------+
| count(*) |
+----------+
|        2 |
+----------+
1 row in set (0.02 sec)
mysql> select count(*) from Log;
+----------+
| count(*) |
+----------+
|       41 |
+----------+
1 row in set (0.00 sec)
mysql> select count(*) from StructuredData_Joppli;
+----------+
| count(*) |
+----------+
|    11433 |
+----------+
1 row in set (0.16 sec)
mysql> select count(*) from StructuredData_Joppli_Product;
+----------+
| count(*) |
+----------+
|   130784 |
+----------+
1 row in set (0.20 sec)

uPDATE


磁盘使用情况

root@scraper:/tmp# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G  4.7G   15G  26% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            237M  4.0K  237M   1% /dev
tmpfs            49M  188K   49M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            245M     0  245M   0% /run/shm
none            100M     0  100M   0% /run/user
时间:原作者:5个回答

0 0

似乎你的查询返回了了一幅中间结果集需要创建临时表,并且配置的位置对my sql临时磁盘表( /tmp ) 不足以容纳生成的临时表。

你可以试着将tmpfs分区大小增加重新挂载它:

mount -t tmpfs -o remount,size=1G tmpfs /tmp

可以使此更改永久生效通过编辑/etc/fstab

如果无法做到这一点你可以尝试更改磁盘临时表的位置通过编辑" tmpdir " 条目my .cnf文件中( 或将其添加( 如果还没有存在) 。 请记住,你选择的目录应仅可由my sql用户

你还可以尝试禁止创建磁盘上的临时表通过增加my sql配置选项的值:

tmp_table_size
max_heap_table_size

较大的值。 则需要增加上述两个参数

例如:

set global tmp_table_size = 1G;
set global max_heap_table_size = 1G;
原作者:
0 0

你只需要修复表,该表用于搜索查询。 此问题通常发生在搜索查询。

转到" table_name " > 操作 > 修复 ( 只一个单击) 效果会花费很多时间应用

原作者:
...