Securing /tmp and Mysql problems


Well-Known Member
Jun 1, 2002
I have a customer who is complaining about mysql problems after i used /scripts/securetmp to secure the /tmp directory on my Cpanel servers. Can someone elaborate on the issue brought up by the customer in the chat session transcript below. Have I caused a problem to our customers who use mysql when I ran /scripts/securetmp?


Support : Hi xxxxxx. How can I help you?
Customer : MySQL cannot write to: /tmp/#sql_1b9b_0.MYI
Customer : I looked at /tmp and only root has write privilege,
Customer : I think maybe that particular file is locked, perhaps, also.
Support : Yes. /tmp is sometimes used to compile break in programs by hackers. We have secured it.
Customer : MySQL uses it for temporary tables.
Support : Hmmm. I am not aware that this is an issue with typical mysql usage. I will have to investigate and get back to you on this one. Are you using PHP to create tables or databases or something of that nature?
Customer : MySQL uses an environment variable TMPDIR that points to the particular directory. I am not creating tables. When a query runs, the MySQL program may create a temporary table for its own use. I do use PHP, but I also use other tools that failed as well.


Well-Known Member
Jun 1, 2002
Originally posted by SarcNBit
Do you have a mysql.sock link in your /tmp directory?
Yes, there is a mysql.sock file in the /tmp

lrwxrwxrwx 1 root root 25 Jun 20 03:16 mysql.sock -> /var/lib/mysql/mysql.sock=
-rw------- 1 adifffi adisai 142 Jun 26 03:28 sess_3d6227cdd51978b6e6018c9654bf0f5f
-rw------- 1 adifffi adisai 142 Jun 26 04:32 sess_ec234893bee6b57d2dcf3a93e9de2c09


Well-Known Member
Apr 16, 2002
N.W. Iowa
If your having problems with the /tmp folder, change the setting in your my.cnf file, under the [mysqld] group, set your tmpdir:
tmpdir = /path/to_new/tmpfolder
change it and see if that helps.

Thread starter Similar threads Forum Replies Date
K Databases 1
S Databases 2
J Databases 1
G Databases 1
Masimo Databases 6