sup*_*ero 28 mysql sql mysql-error-126
我阅读了以下有相关性的问题,但回复并没有让我满意:MySQL:#126 - 表的密钥文件不正确
运行查询时出现此错误
错误126(HY000):表`的密钥文件不正确
当我试图找到问题时,我找不到一个,所以我不知道如何用修复命令修复它.是否有任何指示我如何找到导致此问题的问题以任何其他方式然后我已经尝试过?
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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
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)
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
Cil*_*ier 40
您的查询似乎返回一个大的中间结果集,需要创建一个临时表,并且mysql临时磁盘表(/ tmp)的配置位置不足以生成临时表.
您可以尝试通过重新安装来增加tmpfs分区大小:
mount -t tmpfs -o remount,size=1G tmpfs /tmp
Run Code Online (Sandbox Code Playgroud)
您可以通过编辑/ etc/fstab使此更改成为永久更改
如果您无法执行此操作,可以尝试通过编辑my.cnf文件中的"tmpdir"条目来更改磁盘临时表的位置(如果尚未添加,则添加它).请记住,您选择的目录应该是mysql用户可写的
您还可以通过增加mysql配置选项的值来尝试阻止创建磁盘上的临时表:
tmp_table_size
max_heap_table_size
Run Code Online (Sandbox Code Playgroud)
更大的价值观.您需要增加上述两个参数
例:
set global tmp_table_size = 1G;
set global max_heap_table_size = 1G;
Run Code Online (Sandbox Code Playgroud)