Problem: The MySQL variable tmpdir is set to a directory that cannot be written to when using PHP to access MySQL. To verify this enter MySQL at the command line and type show variables. You will get a long list and one of them will read:
tmpdir = /somedir/
Solution: Alter the tmpdir variable to point to a writable directory.
1. Find the my.cnf file. this is usually in /etc/.
2. Once found, open this in a simple text editor and find the [mysqld] section.
3. Under this section, find the tmpdir line. If this line is commented (has a # at the start), delete the # and edit the line so that it reads: tmpdir = /writable/dir where /writable/dir is a directory to which you can write. Some use /tmp, or you might also try /home//.
4. Save the file.
5. Shutdown MySQL by typing mysqlshutdown -u -p shutdown.
6. Start MySQL by going to the MySQL directory and typing ./bin/safe_mysqld &. Usually the MySQL directory is in /usr/local or sometimes in /usr/ on Linux systems.
If you do not have an access of SSH then you can consult your hosting service provider to resolve this issue.