Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-04-2013, 11:58 PM   PM User | #1
Jordann
New Coder

 
Join Date: Aug 2012
Location: New Zealand
Posts: 49
Thanks: 2
Thanked 3 Times in 3 Posts
Jordann is an unknown quantity at this point
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 :\
Jordann is offline   Reply With Quote
Old 02-05-2013, 01:21 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Tags
database, mysql, php, phpmyadmin, sql

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:00 PM.


Advertisement
Log in to turn off these ads.