MySQL, Error 126: Incorrect key file for table

前端 未结 5 1429
一向
一向 2020-12-03 04:35

I read the following question that has relevance, but the replies didn\'t satify me: MySQL: #126 - Incorrect key file for table


The problem

When runn

相关标签:
5条回答
  • 2020-12-03 05:08

    If your /tmp mount on a linux filesystem is mounted as overflow, often sized at 1MB, ie

    $ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    udev            7.9G   12K  7.9G   1% /dev
    tmpfs           1.6G  348K  1.6G   1% /run
    /dev/xvda1      493G  6.9G  466G   2% /
    none            4.0K     0  4.0K   0% /sys/fs/cgroup
    none            5.0M     0  5.0M   0% /run/lock
    none            7.9G     0  7.9G   0% /run/shm
    none            100M     0  100M   0% /run/user
    overflow        1.0M  4.0K 1020K   1% /tmp               <------
    

    this is likely due to you not specifying /tmp as its own partition and your root filesystem filled up and /tmp was remounted as a fallback.

    I ran into this issue after running out of space on an EC2 volume. Once I resized the volume, I ran into the /tmp overflow partition filling up while executing a complicated view.


    To fix this after you've cleared space/resized, just unmount the fallback and it should remount at its original point (generally your root partition):

    sudo umount -l /tmp
    

    Note: -l will lazily unmount the disk.

    0 讨论(0)
  • 2020-12-03 05:09

    You just need to repair your table which use in search query. this problem generally occur on search query.

    go to "table_name" -> operation- > repair (just one click) effect may take some time to apply

    0 讨论(0)
  • 2020-12-03 05:13

    In my case I just cleared temp files form temp location:

    my.ini

    tmpdir = "D:/xampp/tmp"

    And it worked for me.

    0 讨论(0)
  • 2020-12-03 05:27

    It appears that your query is returning a large intermediate result set requiring the creation of a temporary table and that the configured location for mysql temporary disk tables (/tmp) is not large enough for the resulting temporary table.

    You could try increasing the tmpfs partition size by remounting it:

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

    You can make this change permanent by editing /etc/fstab

    If you are unable to do this you could try changing the location of disk temporary tables by editing the "tmpdir" entry in your my.cnf file (or add it if it is not already there). Remember that the directory you choose should be writable by the mysql user

    You could also try preventing the creation of an on disk temporary table by increasing the values for the mysql configuration options:

    tmp_table_size
    max_heap_table_size
    

    to larger values. You will need to increase both of the above parameters

    Example:

    set global tmp_table_size = 1G;
    set global max_heap_table_size = 1G;
    
    0 讨论(0)
  • 2020-12-03 05:28

    Splitting a complex query into multiple ones would be faster without needing to increase the temp table size

    0 讨论(0)
提交回复
热议问题