mysql and tmp dir problems


Well-Known Member
Dec 31, 2006
Istanbul / TURKEY
cPanel Access Level
Root Administrator
Happy New Year Everyone,

As a CPanel noob, I have 2 problems. But before that let me explain what I did to my new server. First I secured the temporary directories. Then moved my newly installed mysql 5.0 datadir to the second drive.

Here are my problems:

1. I transfered files and everything of mysql to the secondary drive. Change my.cnf accordingly. However whenever I restart mysql from WHM, I get the infamous socket error of mysql. I created a symlink of the sock file. It works OK but whenever I restart mysql, the smylink is gone mysql starts properly but I get the error message:

/usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists! mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").

And phpmyadmin also gives me an error : #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured).

This is very strange as mysql starts and stops with no problems. Why is the smylink needed ? and how can I make in permanent. I searched the forums but couldn't find the solution to this.

2. My /tmp directory is protected so that nothing is executed in it.
/dev/tmpMnt /tmp ext2 loop,noexec,nosuid,rw 0 0
After doing this I started getting errors from various applications. Like the phpmyadmin in Cpanel. It gives the error that sessions are not writable in tmp directory. I've done the same thing in my other server, which has Plesk, and have no problems about it. What do I have to do any ideas ?


Well-Known Member
Mar 13, 2006
Brno, Czech Republic
ln -s /var/lib/mysql /path/to/new/mysql/dir