GeeCON Prague 2014*
The moose likes JDBC and the fly likes Access denied for user 'root@localhost' (using password:NO) error in MySQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Access denied for user Watch "Access denied for user New topic
Author

Access denied for user 'root@localhost' (using password:NO) error in MySQL

Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Dear All,

This is regarding an error i get during the configuration of MySQL. If its not the appropriate forum, moderators please move this thread to the one.

I have been trying to install MySQL 5.0 in Windows XP. The installation was successful but during the final step of configuration i had been getting this error,

Error Nr 1045. Access denied for user 'root@localhost' (using password:NO).

I have been searching in google and mysql forums as well. As someone else suggested i have opened the TCP/IP Port 3306 (where MySQL gets installed as a service and listens to any connection request) through the Windows Personal Firewall (inside Control Panel) . I verified the same in command prompt through 'netstat -a' command also.

When the same issue arose in my home pc, i got it resolved through excluding the port through Personal Firewall

The only difference is i am inside a corporate network here at office.

Can anyone help me out in resolving this issue?

Am i missing something here?

Thank you in advance.
[ December 03, 2007: Message edited by: Raghavan Muthu ]

Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Bindesh Nair
Greenhorn

Joined: Oct 09, 2007
Posts: 12
Few quick things that I would check for are :


1. Is the current user a local admin on the box, else you wont have permissions to set the firewall (to the best i know)

2. Take an output of netstat - aon and see which process is binded to what .. If possible paste it here too

3. Did you give a password at the time of configuration ?

4. Are you able to do a telnet to port 3306 ?

Thanks
[ December 03, 2007: Message edited by: Bindesh Vijayan ]
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Hello Bindesh,

Thank you so much for the quick attention. here you go..


1. Is the current user a local admin on the box, else you wont have permissions to set the firewall (to the best i know)


Yes very much. I do have the admin rights


2. Take an output of netstat - aon and see which process is binded to what .. If possible paste it here too


Here it is...

PROTO Local Address Foreign Address State PID
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 2296

Is that what you wanted?


3. Did you give a password at the time of configuration ?


Yes. As it asked me to enter the password during the last but one step.


4. Are you able to do a telnet to port 3306 ?


Yes. I was able to. It displays the following result.

A
5.0.45-community-nt♦*_~|uV-{,☻I:&L.@6.%kpm


Thank you.
[ December 03, 2007: Message edited by: Raghavan Muthu ]
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
The "Access denied" error means that the connection is fine, but after you connect, you cannot authenticate.
Please check the MySQL install documentation for user setup (if I recall correctly, you need to specify both user and host, like "root@localhost")
in a users table.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Originally posted by Edvins Reisons:
The "Access denied" error means that the connection is fine, but after you connect, you cannot authenticate.
Please check the MySQL install documentation for user setup (if I recall correctly, you need to specify both user and host, like "root@localhost")
in a users table.


Thank you Edvins. But we generally do NOT deal with the user table during configuration right?

The same worked in my home pc without any extra efforts. :roll:
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
Have you found the install documentation ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

Access denied for user 'root@localhost' (using password:NO).

The "using password:NO" means you are trying to connect without a password, or with an empty password. As you have set one in the setup, this is not allowed, and the connection fails.

Apparantly the installation itself ignores the password it has just set. If that's the case, it's a huge bug from the people at MySQL.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Originally posted by Edvins Reisons:
Have you found the install documentation ?


Yes i did find and go through. Nothing new i found out in the documentation.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Originally posted by Rob Prime:

Apparantly the installation itself ignores the password it has just set. If that's the case, it's a huge bug from the people at MySQL.


I think you are right Rob. That's way it looks to me too though.

But still how come the same got resolved in my home pc but not here! quite confused and getting bugged off! I tried completing by NOT giving the password for root user.

The configuration was successful but i could not proceed further as my login to mysql was not getting in as i am not aware of the default password being set.

Any idea for this?
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
Raghavan,

my experience about two months ago (same DB, same OS) was a quick
and easy installation process. And, according to the documentation
(see here), whether there is an initial password or not
depends on the installation procedure that you choose.
The documentation is, in my experience, accurate and detailed,
so you shouldn't have a problem reinstalling MySQL.

Good luck.
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
I had the same problem a time ago. The problem was that mysql remembered an old password.

You can change your password in the following way


Resetting Permissions Mysql


Hope this helps.


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Originally posted by Edvins Reisons:
Raghavan,

my experience about two months ago (same DB, same OS) was a quick
and easy installation process. And, according to the documentation
(see here), whether there is an initial password or not
depends on the installation procedure that you choose.
The documentation is, in my experience, accurate and detailed,
so you shouldn't have a problem reinstalling MySQL.

Good luck.


Thank you Edvins. But i am sorry to say that its still of NO use! .
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Originally posted by Remko Strating:
I had the same problem a time ago. The problem was that mysql remembered an old password.

You can change your password in the following way


Resetting Permissions Mysql


Hope this helps.


Remko, Thanks a lot man

The link what you have supplied did really work! You deserve a beer for that

As i had never encountered this situation and also enabling the port using the Personal Firewall did resolve that.

Anyways, i have done as what they have suggested by storing the username and password for 'root' user in a .txt file and ran it in command prompt by specifying the --defaults-file and --init-file options. It did work!

Still i wonder how come the same got resolved in my home PC and not in my office PC until i did this work around?

Thank you again for helping me resolve a big issue!
 
GeeCON Prague 2014
 
subject: Access denied for user 'root@localhost' (using password:NO) error in MySQL