#1045 – Access denied for user ‘root’@’localhost’ (using password: NO)

That error means that a webpage is accessing a server that has a password, but is not using one. root@localhost has a password and your mysql_connect() doesn’t have a password parameter. It happens generally when you change the password or user root using phpmyadmin.


1) Go to C:\wamp\apps\phpmyadmin3.2.0.1

2) Open the ‘config.inc.php’ file in editor like Notepad and match the following lines with the parameters.

$cfg[‘Servers’][$i][‘verbose’] = ‘localhost’;
$cfg[‘Servers’][$i][‘host’] = ‘localhost’;
$cfg[‘Servers’][$i][‘port’] = ‘3306’;
$cfg[‘Servers’][$i][‘socket’] = ”;
$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;
$cfg[‘Servers’][$i][‘extension’] = ‘mysqli’;
$cfg[‘Servers’][$i][‘auth_type’] = ‘config’;
$cfg[‘Servers’][$i][‘user’] = ‘[Root User Name]’;
$cfg[‘Servers’][$i][‘password’] = ‘[Root password]’;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true;

3) Replace the ‘[Root User Name]’ and ‘[Root password]’; in the above lines with the root user’s user name of password.

4) Restart mysql service or restart computer

5) Enjoy…!!





Deepak Arora

Deepak Arora is a Software Developer and working continuously in this field from 2011. He work mainly with Microsoft Technology. He holds a Master's in Computer Application and he is MCTS certified person.

2 thoughts on “#1045 – Access denied for user ‘root’@’localhost’ (using password: NO)

  1. It’s a pity you don’t have a donate button! I’d most certainly donate to this outstanding blog! I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account. I look forward to fresh updates and will talk about this blog with my Facebook group. Chat soon!

  2. I just want to mention I am newbie to blogging and honestly liked this web page. Almost certainly I’m want to bookmark your blog post . You really have great writings. With thanks for revealing your web-site.

Leave a Reply

Your email address will not be published. Required fields are marked *