Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2012
    Location
    New Zealand
    Posts
    52
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Error: Access denied for user 'cookie'@'localhost' (using password: NO)

    Title says it all, Below is my connection code.

    PHP Code:
    <?php   

        define
    ('DB_NAME''user_name');         
        
    define('DB_USER''db_name');           
        
    define('DB_PASSWORD''password');  
        
    define('DB_HOST''localhost');  

            
    $conn mysql_connect(DB_HOSTDB_USERDB_PASSWORD) or die ('Error connecting to mysql');
            
    mysql_select_db(DB_NAME);
    ?>
    Can anyone see why im getting this error?

    I have access to the databse, and the user and pass im using are correct and its still not working :\

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Double check your actual DB_PASSWORD and password settings for it. According to the error, you are denied and not providing it with a password.
    Another thing to watch for is localhost versus % username settings. These are two separate users, so user@localhost isn't the same as user@domain.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •