jump to navigation

MySQL: access denied for user: (Using password: YES) June 30, 2005

Posted by javafoo in javanotes, jdbc, mysql.
trackback

More experimenting with struts. So I got ambitious, downloaded MySQL and tried to wire a database into my simple struts app. Setting up MySQL was a breeze, although it was my first time, except that some time was wasted googling for user account creation etc.
So, I set up a datasource in Tomcat, which could be looked up by JNDI. I added this in server.xml.
But was getting errors with Context.lookup, indicating there was no “java:comp/env/jdbc” in the Context. Realized I forgot to add the resource-ref in my web descriptor.
This done, I was getting a different error.
Access denied for user ‘blah’: (Using password: YES).
What the …, I didn’t set the password as YES, what the heck was going on?
So googled again (one of these days, when someone asks me what tools, IDE I use for development, I will be sure to add ‘Google’ in there, in fact this should come integrated with the IDE, any Exception or Error message should be linked to Google search), anyway I digress.
So this seems to be a common problem. I tweak the user account a bit in MySQL, apparently the host shouldn’t be set as ‘%’, you are better off setting it to ‘localhost’. I also deleted the default user account ”, which is an empty string. So either of these fixed it for me and I am on my way.

Since I am seeing a lot of searches to this post and one of the commentors (Tyler) rightfully indicates that: The “YES” doesn’t mean that you are using the password “Yes” it simply means “Yes” you are using a password. If the password was blank it would have said “No”

That’s what I thought the issue was to start with (that somehow the password was set to ‘Yes’) or atleast that’s what the MySQL message led me to believe, but later when I tweaked the User Account to set the host, I realized what it was trying to tell me.

About these ads

Comments»

1. marc - May 17, 2007

Thanks for helping out!

2. Bale - November 1, 2007

It would be cool if you said HOW to tweak the user account

Please Email me at MRSHarff@gmail.com

3. Joel - March 29, 2008

Thank you for this. I was about to give up on my phpbb3 install. I’m sure you figured this out by now Bale but you use something like phpMyAdmin to access it.

4. Tyler - April 3, 2008

The “YES” doesn’t mean that you are using the password “Yes” it simply mean “Yes” you are using a password. If the password was blank it might say “No”

5. fv - August 22, 2008
6. zsh - August 24, 2008

The problem is the host shouldn’t be ‘%’.
Set it to ‘localhost’. Problem solved.

7. Ryan Stille - August 24, 2008

Wow thanks so much for posting this. I’ve been banging my head for about an hour to get this working. I have no idea why using % does not allow localhost, but after changing it to be ‘localhost’, I’m able to connect.

And for those asking *how* to change it, I did it by connecting to the ‘mysql’ database and then running:

update user set Host=’localhost’ where User=’myUserName’

8. Stillnet Studios » Blog Archive » Problems connecting to MySQL locally - try localhost instead of % - August 24, 2008

[...] via the command line client and via ColdFusion. Finally after some googling I came across this blog post suggesting to change the privilege details to allow connecting from ‘localhost’ instead [...]

9. f1r3br4nd - December 23, 2008

What should you set the host to if you want it to connect from any external IP, and not limit it to just one permitted IP?

10. Gaxton - April 19, 2009

Pls I’m experiencing a serious sql problem… i changed the mysql password then did some changes then afterwards the site would nt open, it keeps saying…..
Access denied for user ‘v_root’@’cgi0603.int.bizland.net’ (using password: YES) even when i changed the password to blank… pls help!

mik - March 16, 2013

change usernape to debian-sys-maint /etc/mysql/debian.cnf
but before that start ur mysql with:mysql -u debian-sys-maint -p

11. NixTe - May 14, 2009

Your major failing Gaxton
Your usernaame your entering is wrong
Its a vroot error

12. Mayank - July 1, 2009

is it configuration problem or permission issue?

13. mcu - July 4, 2009

On a new installation of MySQL, phpMySQL shows under privileges there is a denial of access for ‘any user’ on % for usage privileges. This seems to stop any user matching. Delete these and users can access if they have only specific database access, or create a user that does not match exactly eg on localhost, then they can access. Reason ?

14. akantos - February 8, 2010

hell

15. Tony - March 21, 2010

I had the same problem, fixed it in a few minutes by placing the installation folder back to the website via ftp, the reinstalled it with the new passwords etc and now its fine again. You shouldn’t lose any of the information you stored previously because you don’t get rid of it in the FTP client, all you do is add your installation folder and presto! Email me on tony@excsell.co.uk if you’re still stuck and I’ll try n help the best I can.

16. Abhay Chandel - July 3, 2010

Try this, might do the trick. It will changes your password to something else.

GRANT USAGE ON *.* TO user@host IDENTIFIED BY ‘password’;

Where,
user = username you are trying to connect with.
host = It depends but usually its ‘localhost’
password = the new password you want to set.

Once the new password is set, restart your mysql server and try connecting.

Good Luck
Abhay

17. Javier - July 30, 2010

i dont understand, where i have to write %? can u make a example? or write the code?

18. Manav - August 3, 2010

I was getting errors like:

root@desktop:~# mysql -u root
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

One very good solution worked for me is, just use this command and follow the Instructions:

root@desktop:~# /usr/bin/mysql_secure_installation

19. Sar - December 17, 2010

Thank you guys for help. My problem is fixed.

20. Jonathan - January 2, 2011

Lol! thanks for this post … I appropriately found it on with google

21. Eon - January 27, 2011

Well, im having difficulty now connecting to a remote website’s database (one where i set up the mysql database online using the tool supplied to me)

Access denied for user ‘USERNAME’@” (using password: YES)

any comments / fixes i should know about? I substituted my username there that I actually used, for my own safety

22. Henry - March 12, 2011

Goo solution for us es really amazing tutorial thanks a lot

23. Dave - March 14, 2011

MANY MANY THANKS for this fix – I have searched around for HOURS trying to fix this and just came accross your poats – THANKS !!!!!, Dave ( http://WWW.CAI.ORG )

24. Valentin Badea - May 27, 2011

The solution proposed in this article is good only if you want to connect ONLY to localhost.
If you want to have a runtime configurable host you want to set, for your user, ANY host, so you have to keep ‘%’ in the textbox for host.

What resolved for me was to reset the password for this user. I’ve changed it to ‘abc’ then I’ve changed it again to the desired one and that’s all !

Success !

robert - August 7, 2011

of all the stupid (&^&()*. I’ve been fighting this problem for 2 hours and the problem was the stupid password generated by my web host version of myPHPADMIN. Their password generator apparently generates passwords that cause problems with my local version of MySQL. So I generated a local password and problem solved. Thanks for the tip on trying a password of ABC. As soon as i saw that work, I knew what the problem was.

25. like bali - August 12, 2011

Access denied for user ‘tujeng’@’localhost’ (using password: YES) in C:\xampp\htdocs

pls help …? thanks

26. ram - August 27, 2011

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘”use mysql;”,”delete from user where User=’root’;”and “flush privieges;”‘ at line 1

27. Masivni Podovi - September 12, 2011

Hmmm…This still doesn’t fix my problems, i am trying to isntall some open source script on my server and can’t install it because i got
Mysql Error: Access denied for user ‘ (using password: YES) ..what you say how to fix it? I didn’t find any answer ? thanks

28. Putraa - September 15, 2011

I still don’t understand the correction.
I already use localhost to my Database Host, but still get the error, how to fix this ?

29. noe - October 29, 2011

I solved my issue my creating the database (wordpress) using mysql command prompt then select use existing database on the wordpress installation screen instead of the option to create the database.

30. Praveen Kirsur - November 3, 2011

Its simple and worked for me as in comment 15 Tony said.
What I did in Control Panel
1) -> delete the database
-> create a new database
2) -> delete the user
-> create new user with new password.
Now try, it will work

Thanks
praveen kirsur

Tudor - January 10, 2012

What database did you delete?

31. Asim - December 18, 2011

I have uploaded a website on live domain, it was running good on previous server but when i uploaded the website on new server it says “Access denied for user ‘fast_fs’@’localhost’ (using password: YES)”

I went to MySQL database and created the User fast_fs and add this user with checking all the privileges. But still it showing the same message Access denied for user ‘fast_fs’@’localhost’ (using password: YES)

I will appreciate help for this. asimjamalpk@hotmail.com

Asim

32. Carletta Lingard - February 9, 2012

I am rarely motivated by statistics articles but this report just gave a great deal of authentic and invaluable information that I just have to acknowledge it. I am well-aware of all the importance of this information and salute you with a sincere thanks for your insight.

33. Rajib - February 16, 2012

Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘ncos’@’localhost’ (using password: YES) in C:\wamp\www\ncos\config\connection.php on line 2

Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in C:\wamp\www\ncos\config\connection.php on line 3

Warning: mysql_query() [function.mysql-query]: Access denied for user ‘SYSTEM’@’localhost’ (using password: NO) in C:\wamp\www\ncos\header.php on line 4

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\ncos\header.php on line 4
Access denied for user ‘SYSTEM’@’localhost’ (using password: NO)

could any one help me for this problem

34. Priya Sarin - April 28, 2012

I have had made my desktop application on C#.net with backend mysql. As on the localhost, it was working all good for the connection and database too. But, I am facing problem, while working the database mysql server (online)…While connecting my project application with the online database server mysql. Here, I had attached the code and screenshot of error.

try
{
string vHost = “harihan.com”;
string vPort = “3306″;
string vUser = “harihan_usrpcs”;
string vPass = “pcs789″;
string vDb = “harihan_pcs”;

connectionstr = string.Format(“Data Source={0};Database={1};User Id={2};Password={3};Port={4}”, vHost, vDb, vUser, vPass, vPort);

Application.Run(new PCS());
}
catch (Exception e)
{
Application.Exit();
}

While running the application, the below error is giving at the stage of open connection of database.

Access denied for user ‘harihan_usrpcs’@’122.169.90.38′ (using password: YES)

Any Help will be highly appreciatated. Thanks in advance

35. Death123456789 - June 19, 2012

Best game ever

36. wasi - June 20, 2012

Even myself having same error message “Access denied for user ‘orangehrm’@’localhost’ (using password: YES). Please Check Privileged Database Username and Password Correct. ” on initial configuration

37. Jason - July 5, 2012

OMG i love u man… u r so cool lol!! it worked yeah!!!!!!!!!!!!!!!!!!! es

38. geekdave - September 29, 2012

thanks a lot bro.

39. aeter - November 27, 2012

WTF didn’t work !!!!
Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘mysql16.000webho’@’localhost’ (using password: YES) in /home/a7506188/public_html/install/include/database.php on line 33

Free Web Hosting
Access denied for user ‘mysql16.000webho’@’localhost’ (using password: YES)
thee same damned prob !! :(

40. Team - November 28, 2012

Access denied for user ‘kannur02_bts1′@’localhost’ (using password: YES)

41. Tom Sawyer - December 12, 2012

[...] 还有一个比较特别的地方,在这里记录一下。(using password: YES) 表示你在登录的时候使用了密码。而不是登录user需要使用密码。所以该文章解决的困惑是,为什么我设置了空密码。还提示错误说要使用密码呢。其实不是,只是你在常识用密码登录而已。 [...]

42. site - February 26, 2013

I have a same error of Priya

43. payal agrawal - March 17, 2013

thankyou this information helped me a lot and I could successfully establish the connection

44. JustHost Recommendations - April 10, 2013

I usually do not drop a leave a response, however after reading through a few of the comments on this page MySQL:
access denied for user: (Using password: YES) | Wake up and smell
the java. I do have a couple of questions for you if it’s okay. Is it simply me or does it appear like some of these remarks appear like they are left by brain dead folks? :-P And, if you are writing at additional social sites, I’d like to follow you.
Could you list of every one of your social community
sites like your twitter feed, Facebook page or linkedin profile?

45. Patch - April 30, 2013

I wasted over an hour with the same problem. Deleting the “guest” account resolved it for me.

46. http://www.crazysocialbookmarking.com/AdanBorreg - May 31, 2013

Their rarity has historically made fancy colored diamonds very highly prized in contrast to colorless crystals normally linked to these gemstones.
So, get fashionable with an owner of a style that is unique and can make you appearance and feel your
best. At the final major one I attended in Geneva the jewelry was
being guarded by men with guns.

47. buy best cheap luxury perfume online - July 24, 2013

Highly descriptive post, I loved that a lot. Will there be a part
2?

48. bissell proheat - August 6, 2013

The sign that the intelli-clean does not work is that
when you press the intelli-clean button on the
handle, there is no difference if it is on or off, it does not
change suction. You will find yourself picking up dirt you never imagined was around, and which
you would not be capable of getting out with
many other vacuum cleaners. This brush could be air driven or could be electric and plug into an electric
outlet by the hose outlet.

49. ahmed - August 22, 2013

Link to database cannot be established: SQLSTATE[28000] [1045] Access denied for user ‘root’@’localhost’ (using password: YES)

please help me

50. Cathern - September 28, 2013

Whoa, incredible blog format! How long have you been blogging for?
Your website is great, and content materials are remarkable!

51. tamikafo2 - November 28, 2013

Shemale erotic

http://shemale.erolove.in/?private.tyler

shemaler transexaul sex hardcore transexual sexy pics freeshemaleporn.com

52. krążki ścierne - February 12, 2014

I like the valuable info you supply on your articles.
I’ll bookmark your blog and take a look at once more right here frequently.
I’m somewhat sure I will be told a lot of new stuff proper right here!
Good luck for the following!

53. تجميل وزراعة وتقويم الاسنان - February 14, 2014

تجميل وزراعة وتقويم الاسنان,تجميل الاسنان,تبييض الاسنان,تقويم الاسنان,زراعة الاسنان,تركيبات الاسنان,جراحة الفكين,الخلع الجراحي,عدسات الاسنان,متخصصين واستشاريين,

https://www.facebook.com/dentalimplantegypt

54. http://friendlyempathy56988.pen.io/ - February 27, 2014

You need to take part in a contest for one of the most useful websites on the net.

I’m going to recommend this site!

55. house design - March 12, 2014

It’s very simple to find out any topic on web as compared to textbooks,
ass I found this paragraph at this site.

56. where do you get warts from - March 25, 2014

Before you soon will understand even when you will end up necessitated to help you schedule
a discussion meeting, you could hold on to one thing
inside your. Not all of the health professionals are identical.
Inside the, website different clinical doctors to whom work wart moving.
All these clinical practitioners virtually all have the ability to
managed and in addition get the job done her operation throughout in any case all of
them see fit. In essence, it indicates that even though your new neighbor ended up being necessitated that will schedule a consulting dialogue together with his also his / her primary care provider, the situation carries out not invariably signify that you will definitely be essential.

57. DaniP - April 16, 2014

After two days of searching I found your blog and all I had to change was the host from % to localhost. THANK YOU!!!

58. iredellcap.com - October 4, 2014

Hi there! Someone in my Mysplace grouup sharedd this website with us so I came to give it
a look. I’m definitely loving the information. I’m book-marking and will bee tweeting
this to my followers! Outstanding blog aand superb
design and style.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: