Access Denied error using mySQL through PHP 
Author Message
 Access Denied error using mySQL through PHP

Hello,
I am new to both PHP and mySQL, and I'm having the following error when
viewing a test page through my browser:

Warning: MySQL Connection Failed: Access denied for user:

/home/sites/site346/web/php/1.php4 on line 14

Warning: Supplied argument is not a valid MySQL result resource in
/home/sites/site346/web/php/1.php4 on line 25

Warning: Supplied argument is not a valid MySQL-Link resource in
/home/sites/site346/web/php/1.php4 on line 34

My username and password are definitely correct, but I also get an error
when trying to connect through the MS-DOS command prompt.  My site is hosted
on a Linux server, in case that helps.

Here is the PHP code:

<?php

$db = mysql_connect("myhost", "myusername", "mypassword");

mysql_select_db("mydb");

$result = mysql_query("SELECT * FROM authors");

 print "<table>\n";
 while ($line = mysql_fetch_array($result)) {
     print "\t<tr>\n";
     while(list($col_name, $col_value) = each($line)) {
         print "\t\t<td>$col_value</td>\n";
     }
     print "\t</tr>\n";
 }
 print "</table>\n";

    mysql_close($db);

?>

Please note that mydb, myhost, myusername and mypassword represent my info,
and are not actually in the code on my page.

Am I doing something wrong? Or is it a problem with the server? PLEASE
HELP!!

Thanks.



Wed, 10 Mar 2004 22:50:58 GMT  
 Access Denied error using mySQL through PHP
Your username and password are incorrect, that is the answer.  The top error
is the important one and it says that when you tried to connect as "cuo"
using a password it failed.  Are you sure you are not "root", most of the
hosting i;ve had always give me root access to a mysql socket..?


Quote:
> Hello,
> I am new to both PHP and mySQL, and I'm having the following error when
> viewing a test page through my browser:

> Warning: MySQL Connection Failed: Access denied for user:

> /home/sites/site346/web/php/1.php4 on line 14

> Warning: Supplied argument is not a valid MySQL result resource in
> /home/sites/site346/web/php/1.php4 on line 25

> Warning: Supplied argument is not a valid MySQL-Link resource in
> /home/sites/site346/web/php/1.php4 on line 34

> My username and password are definitely correct, but I also get an error
> when trying to connect through the MS-DOS command prompt.  My site is
hosted
> on a Linux server, in case that helps.

> Here is the PHP code:

> <?php

> $db = mysql_connect("myhost", "myusername", "mypassword");

> mysql_select_db("mydb");

> $result = mysql_query("SELECT * FROM authors");

>  print "<table>\n";
>  while ($line = mysql_fetch_array($result)) {
>      print "\t<tr>\n";
>      while(list($col_name, $col_value) = each($line)) {
>          print "\t\t<td>$col_value</td>\n";
>      }
>      print "\t</tr>\n";
>  }
>  print "</table>\n";

>     mysql_close($db);

> ?>

> Please note that mydb, myhost, myusername and mypassword represent my
info,
> and are not actually in the code on my page.

> Am I doing something wrong? Or is it a problem with the server? PLEASE
> HELP!!

> Thanks.



Thu, 11 Mar 2004 02:15:35 GMT  
 Access Denied error using mySQL through PHP

Quote:

>Warning: MySQL Connection Failed: Access denied for user:

>/home/sites/site346/web/php/1.php4 on line 14

Remember two things:

1. MySQL permissions can be specified on a host-by-host basis.

2. Connecting to 'localhost' gives you a different source address than
connecting to an external interface.


"localhost".

miguel



Thu, 11 Mar 2004 17:24:15 GMT  
 Access Denied error using mySQL through PHP
do you have any *.inc files which consists of your 'mydb, myhost, myusername
and mypassword' info?

if you do, then, you have to include it in your php script.. :)

--
:: YAN ::
adiksu at lycos dot com
Yahoo! Messenger - adiksu_yan
http://adiksu.tripod.com

Quote:
> Hello,
> I am new to both PHP and mySQL, and I'm having the following error when
> viewing a test page through my browser:

> Warning: MySQL Connection Failed: Access denied for user:

> /home/sites/site346/web/php/1.php4 on line 14

> Warning: Supplied argument is not a valid MySQL result resource in
> /home/sites/site346/web/php/1.php4 on line 25

> Warning: Supplied argument is not a valid MySQL-Link resource in
> /home/sites/site346/web/php/1.php4 on line 34

> My username and password are definitely correct, but I also get an error
> when trying to connect through the MS-DOS command prompt.  My site is
hosted
> on a Linux server, in case that helps.

> Here is the PHP code:

> <?php

> $db = mysql_connect("myhost", "myusername", "mypassword");

> mysql_select_db("mydb");

> $result = mysql_query("SELECT * FROM authors");

>  print "<table>\n";
>  while ($line = mysql_fetch_array($result)) {
>      print "\t<tr>\n";
>      while(list($col_name, $col_value) = each($line)) {
>          print "\t\t<td>$col_value</td>\n";
>      }
>      print "\t</tr>\n";
>  }
>  print "</table>\n";

>     mysql_close($db);

> ?>

> Please note that mydb, myhost, myusername and mypassword represent my
info,
> and are not actually in the code on my page.

> Am I doing something wrong? Or is it a problem with the server? PLEASE
> HELP!!

> Thanks.



Sat, 13 Mar 2004 23:39:12 GMT  
 Access Denied error using mySQL through PHP
If username and password are definately correct then
problem is in mysql security.

In 'mysql' database there are tables 'user' and 'db' where
you have to set right host and privileges.

Read more in mysql manual.

Hulkur

--
---
 2B or (not 2B) = FF
---



Tue, 06 Apr 2004 02:26:38 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. error counting using php against one mysql table

2. Access denied error 5 on novell network

3. Access Denied error

4. Access denied (5) errors

5. URGENT - Clarion Dos error 5 - access denied - WHY ???

6. ERROR 5 Access Denied

7. Access Denied Error 5 CFD 3.102

8. ACCESS DENIED error

9. Error 5 Access Denied on Windows 95 clients

10. Error 5 (Access denied) in memo file

11. Access denied errors - Help ??

12. Access denied error ...

 

 
Powered by phpBB® Forum Software