RE: [PHP-DB] Cannot connect to MySQL using
| From: | Nur_Adman at fmi dot com | Date: | Wed, 29 Mar 2006 22:51:41 +0000 |
| Subject: | RE: [PHP-DB] Cannot connect to MySQL using | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-41630@lists.php.net to get a copy of this message | ||
If I used "localhost", the script running well.
But if I used Server name or IP address, the error message displayed :
Warning: mysql_connect() [function.mysql-connect
<http://tu-lip-nt4/CMS/forecast/function.mysql-connect>
]: Host
'157.47.115.180' is not allowed to connect to this MySQL server in
c:\wamp\www\CMS\forecast\includes\db_connection.php on line 10
Error !! Unable to connect to database
Thanks & Regards,
Anita
-----Original Message-----
From: Ralph Brickley [mailto:ralphbrickley@verizon.net]
Sent: Thursday, March 30, 2006 7:39 AM
To: Adman, Nur anita; php-db@lists.php.net
Subject: RE: [PHP-DB] Cannot connect to MySQL using
It looks right on the function use, but you may want to check the
installation of the mySQL service to ensure you have the right setup.
There
is normally always a password on root.
Also, I would be a little more careful of pasting your IP Address into a
message forum. I'm sure we are all honest people but you never know.
Coupled
with your DB name we can now look at your data if we get in.
You didn't tell us what the error was when using 'localhost' versus the
IP
address. What does it say then?
-----Original Message-----
From: Nur_Adman@fmi.com [mailto:Nur_Adman@fmi.com]
Sent: Wednesday, March 29, 2006 2:31 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Cannot connect to MySQL using
Dear All,
I need some help. I`m trying to connect to MySQL using these script :
<?php
$dbHostname = "localhost";
$dbUsername = "root";
$dbPassword = "";
$dbName = "cms";
// Make connection to database
// If no connection made, display error Message
$dblink = mysql_connect($dbHostname, $dbUsername, $dbPassword) or
die("Error !! Unable to connect to database");
// Select database or print error message if unsuccessful */
mysql_select_db($dbName) or die( "Unable to select database
".$dbName);
?>
But if I changed the Hostname with the Server Name/IP Address (not using
localhost), the error message become :
Warning: mysql_connect() [function.mysql-connect
<http://tu-lip-nt4/CMS/forecast/function.mysql-connect>
]: Host
'157.47.115.180' is not allowed to connect to this MySQL server in
c:\wamp\www\CMS\forecast\includes\db_connection.php on line 10
Error !! Unable to connect to database
What should I do?
Thanks & Regards,
Anita