RE: [PHP-DB] Php4 & MySql 3.22.32
| From: | Sam Masiello | Date: | Mon, 19 Jun 2000 15:39:14 +0000 |
| Subject: | RE: [PHP-DB] Php4 & MySql 3.22.32 | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-483@lists.php.net to get a copy of this message | ||
I am not sure if it matters or not, but first try changing 127.0.0.1 to
"localhost."
Also, echo to your browser window the exact username and password that is
being used and try to connect via the command line:
Mysql -h localhost -u <username> -p<password>
...see if you can connect that way first because usually if you can connect
from the command line using the exact same parameters that are being passed
in your mysql_connect statement, all should be well.
Sam Masiello
System Analyst
Chek.Com
(716) 853-1362 x289
smasiello@chekinc.com
-----Original Message-----
From: Witness [mailto:Ben_Meyer@pfm.org]
Sent: Monday, June 19, 2000 11:37 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Php4 & MySql 3.22.32
I'm running Php4 on Apache 1.3.9 with MySql 3.22.32 on Redhat Linux 6.2.
I'm trying to design a website to access a mysql database using php but I'm
getting the following errors:
Warning: MySQL Connection Failed: Access denied for user:
'validuser@my.system.domain' (Using password: YES) in
/home/httpd/php/functions.php on line 25
Warning: Supplied argument is not a valid MySQL-Link resource in
/home/httpd/php/functions.php on line 26
Cannot Connect to Database!
here's some sample code for how I am connecting:
...
$Connection;
$Connected = 0;
$Debug = 1;
...
function Connect_To_Database($User,$Password)
{
global $Connection;
if ($Connected == 1)
{
echo "<STRONG>Already Connected to database!</STRONG>";
echo "Please close the current connection";
exit;
}
$Connection = mysql_connect("127.0.0.1",$User,$Password);
if (!mysql_select_db("validDb",$Connection))
{
echo "<STRONG>Cannot Connect to Database!</STRONG>";
exit;
}
else
{
$Connected = 1;
if ($Debug)
{
echo "<STRONG>Connected!</STRONG>";
}
exit;
}
}
...
Connect_To_Database("validUser","validPassword");
...
Any ideas? I'm lost as to what to do and really need this working soon.
Thanks.
BRM
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net