mysql查大数据时报错Incorrect key file for table ‘/tmp/#sql…'; try to repair it’ in …

今天在php mysql查大数据时报错,<b>Fatal error</b>: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000]: General error:126 Incorrect key file for table ‘/tmp/#sql_72c_0.MYI'; try to repair it’ in …

tmp-err1
当mysql的临时文件大小设置太小,或者由于并发量太大导致临时文件存放的目录空间大小不够时都会报这个错误。”incorrect key file for the table ‘/tmp/#sql….';try to repair it”

一般的tmp目录的权限比较特别是drwxrwxrwt 就是1777
表示任何人都可以在此目录拥有写权限但是不能删除别人拥有的文件。

d:指的是目录
t:sticky bit,设置了粘住位

具体修改临时表目录的步骤为:

1) 查看法语站当前磁盘空间使用情况,建议将临时表存放目录设置在/var下。

tmp-err2
【修改tmp目录】Incorrect <wbr>key <wbr>file <wbr>for <wbr>table <wbr>’/tmp/#sql_bd2_0.MYI’解决
[root@wholesale /]# mkdir /var/tmp
[root@wholesale /]# chmod 1777 /var/tmp/
2) my.cnf中[mysqld]下增加:

tmpdir=/var/tmp

3) 重启mysql服务
4) 查看mysql错误日志情况,看是否报错。
5) 进入mysql查看当前的tmpdir情况,确认是否修改完成
show variables like ‘tmpdir';

tmp-err3

http://blog.sina.com.cn/s/blog_4c197d420101bdn9.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>