note 50102 deleted from function.mysql-connect by bjori
| From: | bjori@php.net | Date: | Sat, 15 Apr 2006 18:33:45 +0000 |
| Subject: | note 50102 deleted from function.mysql-connect by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-108182@lists.php.net to get a copy of this message | ||
Note Submitter: codeslinger at compsalot dot com
----
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 ;-)