Skip to content
Advertisement

Warning: mysql_query(): Access denied for user ‘admin’@’localhost’ (using password: NO) [closed]

It seems as though my PHP is trying to log in to the MySQL database with a username I am not supplying.

The error I am getting is:

JavaScript

I am definitely supplying a password, and am not using “radiocaf” as the username in my connect file, so after 3 hours of staring, I still can’t work out where I am going wrong.

Here is my code:

psl-config.php:

JavaScript

db_connect.php

JavaScript

and then finally, the main page which is where I am receiving the error (I have cut out the HTML between the PHP:

JavaScript

The surrounding HTML is just the layout of the page, essentially just a photoshop layout, sliced and exported to web.

I am fairly new to PHP and so I hope this question is as explained as possible.


Edit:

Thanks so much guys, I apologise that this question seemed poor to some of you that you flagged it. Unfortunately I wouldn’t have seen the “typos” as I really didn’t know that I was attempting to use both mysql and mysqli and that they couldn’t “communicate” with each other. Another issue I found was Dreamweaver uploaded the code from layout.php as db_connect.php. This doesn’t explain (to me at least) how any connection was being made to bring up the access denied error for ‘radiocaf’@’localhost’ though.

Here’s the old code lines I changed (in layout.php):

JavaScript

changed to:

JavaScript

And that’s all it took, but I am entirely grateful! Thanks again everyone!

Advertisement

Answer

You are conflicting MySQL and MySQLi. MySQL and MySQLi are two different methods

Warning is:

JavaScript

But you’re connecting database with mysqli

JavaScript

Warning in php.net:

MySQL extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement