How to Solve Error #1045 in phpMyAdmin

How to Solve Error #1045 in phpMyAdmin
After installing a local WAMP server and trying to access your phpMyAdmin, you may encounter the error:

#1045 Access Denied for user 'root'@'localhost' (using password: YES).

This may happen if your root@localhost database user was not granted the necessary rights to access the database. Or if you provided a wrong password.

In this tutorial, you will learn how to solve this error for the WAMP local server using phpMyAdmin.

If you get the #1045 Access Denied... in phpMyAdmin it will look like the image below:


Let’s learn how to get rid of it.

Step #1. Open Your MySQL Console


  • Left click your WAMP icon located at the bottom right of your desktop.
  • Click on MySQL Console.

Step #2. Enter the Provided Commands


If you have a password, you can ignore this part.

  • Type in:
    use MySQL;
  • Press Enter.
  • Set your MySQL password with the following command, replacing “EnterYourPasswordHere” with your new chosen password:
    UPDATE mysql.user SET Password=PASSWORD("EnterYourPasswordHere") WHERE User="root";
  • Press Enter.
  • Flush the privileges by typing:
  • Exit by typing:
  • Press Enter.

Step #3. Edit Your File


Using a text editor, such as Notepad++, open your file.

  • Go to My Computer > C Drive > (Your Local Server Folder, WAMP/MAMP/XAMPP) > APPS > PHPMYADMIN >
  • Find the following line of code:
    $cfg['Servers'][$i]['password'] = ''; // MySQL password
  • Change the 'password' to the newly chosen password you created in Step #2.
  • Click Save.

Step #4. Access Your phpMyAdmin


  • Go to http://localhost/phpMyAdmin and test your phpMyAdmin access.

Congratulations! You are now able to access your databases.

Additional Reading

What’s Next

Most major website platforms use MySQL as their default database. phpMyAdmin is a free software, written in PHP, which makes it easy to manage your MySQL databases.

Subscribe to our “How to Use phpMyAdmin to Manage MySQL” video class and learn how to install and use phpMyAdmin. This class will be a huge help to you if you use any PHP-based software.


0 0 votes
Blog Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments



Here is the smart way to fix this error 🙂

go to the wamp [w] icon on right side of you desktop near the time.left click go to [mysql] left click [services] select [restart] and smile 🙂

if not restart your pc open browser and refresh the page 🙂


thanxxx it works..


I tried this..both restarting the mysql services and restarting the PC. Neither worked with Firefox.

Erich Marti

it will not work that way, I spent half a day no one around here knows the simple answer to a simple question…you probably installed the MYSQL on your pc long time ago and had set a password that you forgot, neither of changing code works, all you need to do either remebmber the old password or unistal and install the MYSQL


how about this one:

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

Raviteja Panchagnula

One of the possible reasons for this,

make sure that no other MySql is running other than the one in wamp. Check for the mysql running in task manager processes and kill it, before running the wamp. Later restart the wamp and the browser.(Be aware by killing the process the MySql(not in wamp) installed will not work, to make this work again goto mysql installed folder in bin you find mysqld application file run it, then your old mysql(not in wamp) will run again).

miyuru gomes

solved my problem thanks


Nice one thanks alot it really helped me

Ryota Bannai

thanks. My problem, MAMP is running without Apache.


I am having problem plz help me out

Ryota Bannai

what your problem like?


Thank you very much , solved my problem


Sure! Glad to hear our tutorial helped you. We just added some links to related tutorials and video lessons. Please check them out.



thank you so much the easiest and best answer thanks alot


it works, thanks


thank you so much


Greatest tutorial very very helpful


I installed WAMP and ended up changing the port to 8080. because another app was using port 80. That worked and I got Apache working fine. When I go to phpMyAdmin I get the:

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

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

I never logged into phpMyAdmin or set up a password so it should work fine… I try to use the MySql Console and when I try the suggested password it just closes, when I try no password, it just closes. I am the admin. Do you think it has to do with the port change? any suggestions?


This information was really useful, it helped us solve mysql related issue.



thank you so so so much!


You are AWESOME…! This worked like a charm! Thanks so much for taking the time to make this guide!

Bill T

Thank you for this well stated, very straight forward solution to the 1045 error problem. After trying many other proposed solutions, to no avail, this is the one that worked on the first try.


I was searching for this answer whole my live,thanks

Pratik Goyal

You’re truly a superstar… i liked the way you explained… easy steps…saved my time..hats off!


Thank you so much! Worked perfectly for me.


pretty nice solution..#thx 😀

vinod chauhan

there is still an error in using it .. i have dne all thiss,pls help me out


Thank you so much for sharing this useful information. this is really helpful to me and Now every thing is working fine.

Thanks again.


Thank you very much!! Perfect!!!


Thank you very much for this useful information. It really helped.


Hi, this worked. I should add that it didn’t work initially, I had to stop all services (on Wamp) and do a full restart of my computer before it finally worked. Might be because I have Window 7 on a partitioned section of my Mac system?? Thank you very much however. Saved my sanity.




Absolutely amazing! Thanks so much!


Thank You very much for this useful information…


Hello sir,

I could not set password in command prompt. when i run mysql.exe file there also i got same error when i run on browser. that is access denied for localhost user.

Please help me how to solve this error

Thanking you in advance

Zac Ang

It might because u have forget your old password that u have set long long time ago. U can go to previous website projects php files to check the database username and password that open connection of database for your php files.

arshad nawaz

thanks,great work


The fix worked great, but if you’re running WAMP with windows 7 you might need to clear your browser history and run WAMP as administrator.


You saved me my man. Thank you so much


Thanks man. You are indeed good at what you do. thank you once again. you are the man.

Leslie Luke

Need HELP! PLEASE: After installing a local server using WAMP and trying to access phpMyAdmin, I encountered error: #1045 Access Denied for user ‘root’@’localhost’ (using password: YES). I followed Tessa Mero’s instructions described in “How to Solve Error #1045 in phpMyAdmin – June 06, 2012 | Written by Tessa Mero” After typing UPDATE mysql.user SET Password-PASSWORD(“root”) WHERE User=”root”; mysql responed “Query OK, 3 rows affected. Rows matched:3 Changed:3 Warnings:0”. Then I typed FLUSH PRIVILEGES:, mysql responded “->”. What should I type from here? I am a beginner, please tell me what to do:



THANKS in advance


Mysql will always do this, it’s basically asking you to keep going with the statement because you haven’t ended the statement with “;”. 

try this: 
Instead of: 

Leslie Luke

Just sent a message to ask for help regarding what to do after mysql> FLUSH PRIVILEGE:


I fixed the problem by fixing my typing error (“;” instead of “:”). That “:” created a syntax error and mysql returned “->” expecting a new line. Anyway, my problem is fixed and I am inside phpmyadmin now. Thanks!


work fine in my wamp sever. but log in page not show when start first. please any one help me? thanks lot.

Antonio Lacruz

Thank you a thousand times!


Done! Thank you very much. You solve this problem


Awesome… Thank u very much. It worked for me and saved a big trouble.

Ketan Sawant

It is really very valuable



Vikas Sharma

Error is same but it’s showing (using password: no)

and this solution is not working.

Is there any other solution?


hi there

deleted a database from phpadmin then got the error msg

the troubble is i dont have a password to put into msql.exe

as anything i put there says acess denied


Had the same error…
I did not change anything in configuration file.
Just changed
My Chrome->Prop->Target value
From : “C:\Program Files\Google\Chrome\Application\chrome.exe” –disable-web-security
To : “C:\Program Files\Google\Chrome\Application\chrome.exe

Karthick manoharan

no still i done all the changes its not happening ..still acces denied only im getting


you rule indeed


The additional features for working with linked tables have been deactivated. how to solve this problem


Thanks so much! For some reason it didn’t have a root user at all, only controluser (with no privileges). This, however, created the root user (I think it was the FLUSH PRIVILEGES-command that did it)


For anyone who still gets the same error message screen after applying above steps, trying clearing your web browser cache.

Anas Ashraf

Hello every one i lost my file please tell me now what can i do ? how can i recover or install same file in phpmyadmin ??? Please do help me..


Many thanks great help Tessa …


Thank you! This works


I followed all of your steps but get this when entering https://localhost/phpMyAdmin/ into my browser: ‘This webpage is not available’

Soukaina Ouhame

thanks it works 🙂


#1273 how to solve it


I had the same problem and none of this solutions works with me. Finally I realized that I was separately installed mySQL server 5.1 in to my PC. Uninstall it and then works fine along with the wamp default privileges. Thanks for the fix mentioned here. That was helpful too.. 🙂


mind blowing ! 😀

Would love your thoughts, please comment.x