Help with 'Error connecting to mysql'

Discussion in 'PHP' started by chrisj, Dec 3, 2011.

  1. #1
    I tried to upload a file via my web site, which uses a common video file upload script, during the uploading process this page appeared:

    "Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

    So then I looked in the site script's Error Log and I see this:

    PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]:
    Access denied for user 'xyzadmin'@'localhost' (using password: YES) in /home/public_html/logout.php on line 25


    So, I look at line 25 of the login.php file and I see this:

    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

    Can you shed some light on what I might do to remedy this? Or offer some guidance? I'm not very versed in databases, mysql or phpmyadmin.
    Thanks
     
    chrisj, Dec 3, 2011 IP
  2. arpit13

    arpit13 Well-Known Member

    Messages:
    294
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    128
    Digital Goods:
    1
    #2
    are u sure u hav installed the script properly?
    have u made a mysql database,given a mysql user its privileges and made tables in the database,also specified wat $dbhost etc are?
     
    arpit13, Dec 3, 2011 IP
  3. chrisj

    chrisj Well-Known Member

    Messages:
    606
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    are u sure u hav installed the script properly?
    YES
    have u made a mysql database,given a mysql user its privileges and made tables in the database,also specified wat $dbhost etc are?
    YES
     
    chrisj, Dec 4, 2011 IP
  4. mrhrk01

    mrhrk01 Well-Known Member

    Messages:
    664
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    145
    #4
    To me it seems you are trying to connect to a MySQL database using invalid user information.

    1) Ensure the database host, database user name and password are 100% correct in your script and in the location you have created them.
    2) Ensure the MySQL user has the correct privileges
    3) Ensure the MySQL user has access to the database you have created.
     
    mrhrk01, Dec 4, 2011 IP
  5. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #5
    One of $dbhost, $dbuser or $dbpass is wrong, the database is set up incorrectly or the database has a problem (like MySQL crashed).
     
    Rukbat, Dec 4, 2011 IP