note 54834 added to function.mysql-connect
| From: | spam at modem-help dot com | Date: | Sat, 16 Jul 2005 23:44:26 +0000 |
| Subject: | note 54834 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92062@lists.php.net to get a copy of this message | ||
(Centos4, php4, mysql4.1)
If mysql uses a Unix socket to connect, and you move the DB tables from the default directory, **do
not** also change the location or name of the mysql socket file within my.cnf, else your old scripts
will not connect without modification.
The simplest solution is to leave the socket file in it's default location (/var/lib/mysql with
Centos/Redhat). Other options are to set `mysql.default_socket' (see http://www.php.net/manual/en/ref.mysql.php#ini.mysql.default-socket),
or to set the new path within the server option to mysql_connect() as above.
Extra info: Centos4 sets `skip-networking' within my.cnf by default, which causes all mysql
connections to be made via Unix sockets (or named pipes on Windows). This both restricts all
connections to the localhost (a security enhancement) and is faster.
The problem is that, although `mysql.default_socket' is NULL by default, the Unix socket name +
location is both hard-coded into the Centos/Redhat php-mysql RPM libraries *and* PHP will ignore any
my.cnf socket-settings that differ from the defaults.
Brought to you from the School of Hard Knocks.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54834
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54834&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54834&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54834&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54834&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54834&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54834&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54834&report=yes
Search -- http://master.php.net/manage/user-notes.php