#1045 - Access denied for user 'root'@'localhost' (using password: NO)

I have the error(#1045 - Access denied for user ‘root’@‘localhost’ (using password: NO) )
I have read solution on other post that is as follow:
I’m just to confirm you that it’s the solution.

yesterday I tried to fix the problem, but the only think that was missing is the first line in MySQL command:

UPDATE mysql.user

I was writing ( UPDATE mysql ) : so please follow the next steps if you want to resolve your problem with ( #1045 - Access denied for user ‘root’@‘localhost’ (using password: NO):

1 : go to your WAMP icon on your PC desktop screen and LEFT CLICK to open the menu, you will see MYSQL folder, CLICK to see MYSQL CONSOLE, open it.

2: now you have DOS screen ( a black screen ) :

A: if you already set a password, type it
B: if you did not do this step yet, write the following red text
B1: use mysql; and click ENTER on your keyboard
3: now write the following red text and click ENTER :

UPDATE mysql.user
->SET Password=PASSWORD(“*******”)
->WHERE User=“root”;

don’t worry about this sign ( -> ) , because for example when you write ( UPDATE mysql.user ) and you click ENTER on your keyboard, a new line appear with this sign ( -> ), your command will execute when you write this sign ( ; ) at the end of your text and click ENTER.

NOTE: replace the password ******* by your password.

4: now write the following red text and click ENTER :


5: and to exit the black DOS screen now, write exit and click enter.

------------------------- we are finished from MySQL now --------------

6: go to WAMP folder ( open your My Computer, click on C driver, and you will see WAMP folder ), click on APPS folder, and than click on your PHPMYADMIN folder ( e.g my folder called phpmyadmin2.11.6 ) and find the config.inc.php

7: open config.inc.php and find the following orange text:

$cfg[‘Servers’][$i][‘password’] = ‘’; // MySQL password (only needed

and add your password now that you used in step number 3 like that :

$cfg[‘Servers’][$i][‘password’] = ‘yourpasswordhere’; // MySQL password (only needed

8: now save this modification, and close config.inc.php

9: go to your web browser and type the following link :


and enjoy, this is what happened with me.

NB: I wrote all this explications, because I’m also learning PHP and I found a lot on this website helped me, so I’m trying also to help you.

But in the Mysql console: i stuck with the following image

I have no idea what password it is asking for can you help me.



What this error message means is that the connection to the database is not correct.

Somewhere you will have either a config file or a connect file. In this file you have to have your username and password for the database that you are trying to connect to.

It will look something like this:

$hostname='localhost'; //// specify host, i.e. 'localhost'

$user='SomeUserNameHere'; //// specify username
$pass='SomePasswordHere'; //// specify password
$dbase='SomeDatabaseNameHere'; //// specify database name

Once you find that and update it with the details ($hostname will usually stay as localhost) then all should work!

Actually my problem is that when i open phpmyadmin from localhost page. i get the above error. i am unable to even to the mysql page, so i am unable to create any sot of database.
in the config.inc php file i have following code
$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’;
$cfg[‘Servers’][$i][‘password’] = ‘’;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true;

Here i am not using the password in secondlast line of the code.
Any sort of help would be appreciated.

Is your phpadmin a local install (on your own pc) or on a host (like you log in where your website is located?

my phpadmin is local install on my pc…

Change the following database config values in your config.default.php:

$cfg[‘Servers’][$i][‘host’] = ‘localhost’;
$cfg[‘Servers’][$i][‘port’] = ‘3306’;
$cfg[‘Servers’][$i][‘ssl’] = false;
$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;
$cfg[‘Servers’][$i][‘extension’] = ‘mysqli’;
$cfg[‘Servers’][$i][‘compress’] = false;
$cfg[‘Servers’][$i][‘user’] = ‘root’;
$cfg[‘Servers’][$i][‘password’] = ‘YOUR_Password’;

It worked for me. Hope this helps!

Okay i am also getting this error and that wasn’t able to fix it. I’ve looked in the mysql log and it appears to be a problem with the host:

120803 7:21:31 InnoDB: 1.1.8 started; log sequence number 1595675
120803 7:21:31 [Note] Server hostname (bind-address): ‘(null)’; port: 3306
120803 7:21:31 [Note] - ‘(null)’ resolves to ‘::’;
120803 7:21:31 [Note] - ‘(null)’ resolves to ‘’;
120803 7:21:31 [Note] Server socket created on IP: ‘’.
120803 7:21:31 [Note] Event Scheduler: Loaded 0 events
120803 7:21:31 [Note] wampmysqld: ready for connections.
Version: ‘5.5.24-log’ socket: ‘’ port: 3306 MySQL Community Server (GPL)

Am i right in thinking that it should say ‘localhost’ where it says ‘(null)’? Since it seems to attempt to resolve localhost to an ip anyway, i shall try replacing localhost with in the config file and will post with my results shortly

Results: Nope, i still get the same thing in the log file which seems odd? I’m stumped! Ill copy and paste my config file just incase anyone can see an error in that that i can’t?:


/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$cfg[‘Servers’][$i][‘verbose’] = ‘’;

[‘host’] = ‘’;
$cfg[‘Servers’][$i][‘port’] = ‘3306’;
$cfg[‘Servers’][$i][‘socket’] = ‘false’;
$cfg[‘Servers’][$i][‘connect_type’] =

$cfg[‘Servers’][$i][‘extension’] = ‘mysqli’;
$cfg[‘Servers’][$i][‘auth_type’] = ‘config’;
$cfg[‘Servers’][$i][‘user’] = ‘root’;

[‘Servers’][$i][‘password’] = ‘**********’;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true;

/* End of servers configuration */


[‘DefaultLang’] = ‘en-utf-8’;
$cfg[‘ServerDefault’] = 1;
$cfg[‘UploadDir’] = ‘’;
$cfg[‘SaveDir’] = ‘’;

/* rajk - for blobstreaming */

[‘Servers’][$i][‘bs_garbage_threshold’] = 50;
$cfg[‘Servers’][$i][‘bs_repository_threshold’] = ‘32M’;

[‘bs_temp_blob_timeout’] = 600;
$cfg[‘Servers’][$i][‘bs_temp_log_threshold’] = ‘32M’;


NOTE: There is a password in place of the asterisks, obviously!

I had to change this line
$cfg[‘Servers’][$i][‘extension’] = ‘mysqli’;

to this
$cfg[‘Servers’][$i][‘extension’] = ‘mysql’;
and that worked for me
I also installed with no password as I saw a couple other posts reference problems related to doing that.

Really? I’ve been scouring through files i dont fully understand for hours and its the letter i that doomed me! Thanks so much for your help :slight_smile:

i was in the same boat. I think you may come across a second error associated with this change. Can’t remember what it was now. But you will know where to look

$cfg[‘Servers’][$i][‘password’] = ‘yourpassword’;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true;