Problem
Recently in a website we were developing in Codeigniter PHP Framework, some of the urls stopped working and started throwing 500 internal server error. On investigation we found a MySQL query which was causing the problem .Query is simple but when we ran it directly at MySQL prompt it showed :
Error Code : 3. Error writing file ‘/tmp/MYMI5iqH’ (Errcode: 28) error .
Error was also there in mysql (/var/logs/mysqld.log) :
Can’t create/write to file ‘/tmp/ib8WeOUJ’
With following command in ubuntu terminal we got the error description :
Command : perror 28
Description : OS error code 28: No space left on device
So that was the actual reason, no space left in the partition in which /tmp folder is located.
To resolve this, you can stop MySQL, empty /tmp folder and restart it.
There is one more solution.
You can change the tmpdir location for mysql :
1. Go to /etc/my.cnf.
2. Set tmpdir location here to point to new folder in a different partition.
tmpdir=/mnt/logs/tmpdir