Re: PHP with MySQL
| From: | Mike Eheler | Date: | Fri, 03 May 2002 01:28:14 +0000 |
| Subject: | Re: PHP with MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95807@lists.php.net to get a copy of this message | ||
Typically it's done like:
$db = mysql_connect('localhost','username','password');
The MySQL database detects what host you're connecting from, and appends that to your username. I'm not sure if it's possible to specify an alternate host.
So if both PHP and MySQL are on the same machine, and you connect to the MySQL server as 'username', MySQL will see you as 'username@localhost'.
Mike
Paras Mukadam wrote:
Hi Gurus, one MySQL - PHP query : while granting permissions to particular user in MySQL, the administrator has to give username@machine_address !! Then how can we connect to MySQL through PHP only by passing "username" as one of the arguments to mysql_connect() ? Thanks. Paras.