阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

MySQL ERROR 1878 解决办法

179次阅读
没有评论

共计 2042 个字符,预计需要花费 6 分钟才能阅读完成。

MySQL ERROR 1878 报错解决办法

错误重现
Part1: 大表修改字段
mysql> ALTER TABLE `erp`
    -> ADD COLUMN `eas_status`  tinyint(3) unsigned  NOT NULL DEFAULT 0 ‘ AFTER `totalprice`;
ERROR 1878 (HY000): Temporary file write failure.
mysql> \q
 
这里可以看到,添加字段的时候爆出了 1878 错误。

Part2: 排错过程
先看数据库的 error 日志
2016-10-27 10:19:22 7f5dca1bf700 InnoDB: Error: Write to file (merge) failed at offset 258998272.
InnoDB: 1048576 bytes should have been written, only 651264 were written.
InnoDB: Operating system error number 0.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 0 means ‘Success’.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2016-10-27 10:35:34 7f5dcb42f700 InnoDB: Error: Write to file (merge) failed at offset 88080384.
InnoDB: 1048576 bytes should have been written, only 782336 were written.
InnoDB: Operating system error number 0.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 0 means ‘Success’.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2016-10-27 10:37:02 7f5dd0076700 InnoDB: Error: Write to file (merge) failed at offset 88080384.
InnoDB: 1048576 bytes should have been written, only 770048 were written.
InnoDB: Operating system error number 0.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 0 means ‘Success’.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html

查看错误日志可以看到磁盘空间不足

Part3: 验证
[root@dev1 helei]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      45G  43G  160M 100% /
tmpfs                7.9G  1.2M  7.9G  1% /dev/shm
/dev/sda1            477M  90M  358M  21% /boot
 
可以看到磁盘空间不够了,需要释放磁盘空间,

——总结——
原因是 mysql 的 tmpdir 分区的剩余空间大小没有 erp 大。mysql 在 alter table 时需要的临时空间要比该表才行。由于笔者的水平有限,编写时间也很仓促,文中难免会出现一些错误或者不准确的地方,不妥之处恳请读者批评指正。

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-11/136689.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计2042字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中