Warning: mysql_connect() [function.mysql-connect]: Access denied for user

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • benicio
    New Member
    • Oct 2008
    • 16

    #1

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user

    i got this error after uploading all the files in www folder. i'm using wamp.

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localho st' (using password: YES) in /home/.../public_html/....com/includes/connection.php on line 5
    Database connection failed: Access denied for user 'root'@'localho st' (using password: YES)

    how can i fix this? i'm really new to this.
  • benicio
    New Member
    • Oct 2008
    • 16

    #2
    this is the error log

    error_log

    PHP Warning: mysql_connect() [<a href='function. mysql-connect'>functi on.mysql-connect</a>]: Access denied for user 'root'@'localho st' (using password: YES) in /home/.../public_html/....com/includes/connection.php on line 5

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hi.

      It's like the error message says. You are trying to connect to a MySQL database using invalid user information.

      You should create a new user and give him access to the database you are going to be using.
      Then you need to update your PHP code so that it uses the info for that user, rather then the old one.

      Also, keep in mind that using the root user in a PHP script is a HUGE security risk. You should always create a limited user to use in your websites.

      If you don't know how to do that, check out the GRANT statement in the MySQL manual.

      Comment

      Working...