GNU Info

Info Node: (mysql.info)Problems with mysql.sock

(mysql.info)Problems with mysql.sock


Next: Timezone problems Prev: Temporary files Up: Administration Issues
Enter node , (file) or (file)node

How to Protect or change the MySQL socket file `/tmp/mysql.sock'
----------------------------------------------------------------

If you have problems with the fact that anyone can delete the MySQL
communication socket `/tmp/mysql.sock', you can, on most versions of
Unix, protect your `/tmp' file system by setting the `sticky' bit on
it.  Log in as `root' and do the following:

     shell> chmod +t /tmp

This will protect your `/tmp' file system so that files can be deleted
only by their owners or the superuser (`root').

You can check if the `sticky' bit is set by executing `ls -ld /tmp'.
If the last permission bit is `t', the bit is set.

You can change the place where MySQL uses / puts the socket file the
following ways:

   * Specify the path in a global or local option file.  For example,
     put in `/etc/my.cnf':

          [client]
          socket=path-for-socket-file
          
          [mysqld]
          socket=path-for-socket-file
     Note: Option files.

   * Specifying this on the command line to `safe_mysqld' and most
     clients with the `--socket=path-for-socket-file' option.

   * Specify the path to the socket in the `MYSQL_UNIX_PORT' environment
     variable.

   * Defining the path with the `configure' option
     `--with-unix-socket-path=path-for-socket-file'. Note: configure
     options.

You can test that the socket works with this command:

     shell> mysqladmin --socket=/path/to/socket version


automatically generated by info2www version 1.2.2.9