MySQL connect enquiy

Discussion in 'The Lounge' started by GoldMoe, Jun 23, 2011.

  1. GoldMoe

    GoldMoe New Member

    Hi all,

    I have been trying to connect to a database using a username and password which I have created through cPanel, and added to them to the database. I have used the following to connect:

    <?php

    //connect script

    $erorr = "Problem connecting to database. Please try again later.";

    $connect = mysql_connect("mydomain.com", "username", "password") or die ($erorr);
    mysql_select_db("mydatabase") or die ($erorr);

    ?>

    The output is as follows:

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'username'@'host.mydomain.com' (using password: YES) in /home/public_html/connect.php on line 7

    btw, I made sure many times to put the right authentication info, so there is nothing wrong with the username and the password.

    Please guide how to fix this error and I will be greatly appreciated.

    Thank you in advance
     

Share This Page