access denied

Discussion in 'PHP' started by kharearch, Dec 18, 2007.

  1. #1
    When I am running my code it is giving following error -

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'sanganak_arch'@'localhost' (using password: YES) in E:\xampplite\htdocs\practice\sunil\showdata2.php on line 10
    Could not connect: Access denied for user 'sanganak_arch'@'localhost' (using password: YES)

    my code is following -

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <?php
    $con = mysql_connect("localhost","sanganak_arch","reset123");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }mysql_select_db("sanganak_mydata",$con);
    $result = mysql_query("SELECT * FROM mytable");
    while($row = mysql_fetch_array($result))
    {
    echo $row['name'] . " " . $row['age'];
    echo "<br />";
    }mysql_close($con);
    ?>
    </body>
    </html>


    I have given all privileges to my database. Please solve this error.
     
    kharearch, Dec 18, 2007 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    Thus you suppose
    PHP thinks that there are not enoigh priveleges.
    Check you priveledges once again or try root user with empty password.
     
    AsHinE, Dec 18, 2007 IP