note 50102 added to function.mysql-connect
| From: | codeslinger at compsalot dot com | Date: | Fri, 18 Feb 2005 03:15:28 +0000 |
| Subject: | note 50102 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85189@lists.php.net to get a copy of this message | ||
There are two ways to connect to the local server.
1) If you want to specify a Port # you MUST use 127.0.0.1 for the Host name. When you specify
"localhost" the Port number is ignored and the default socket is used instead.
Example: $Host = "127.0.0.1:4321";
2) If you want to specify a socket path, the host name is optional, but if used, it MUST be
"localhost".
Example: $Host = "localhost:/path/to/socket";
or $Host = ":/path/to/socket";
========
Note: That giving the specified user permission to login from "localhost" is NOT the
same as giving them permission to login from "127.0.0.1" and vice versa. If you want to
be able to login from both then you must create two entries, one for each host name, in the
mysql.user table.
It is a really bad idea to allow logins from any computer by specifying the host wild card. And
elsewhere on this page is some horrible advice to specify a blank password... Don't Do It
unless you want your server cracked in about 5 minutes flat. Using old_password() as described
below, works just fine for php compatibility.
Remeber after adding or changing user permissions you MUST do a FLUSH PRIVILEGES; the change that
you made does not take effect until you do... Guess how I know this ;-)
----
Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50102
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50102&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50102&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50102&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50102&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50102&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50102&report=yes
Search -- http://master.php.net/manage/user-notes.php