Solved

mysql Access denied for user 'username' '@'%' to database databasename

Posted on 2012-04-01
5
313 Views
Last Modified: 2012-04-01
Hi,
I am getting the following error when my application tries to connect to the Mysql database.
mysql Access denied for user 'username' '@'%' to database databasename

The application uses and ODBC connection for its connection - funny enough the test connection works fine through the ODBC connection test but when the application tries to connect it gets the error shown above.
One of the other instances of this application initially had an error that said to flush-hosts which I have done and that instance now connects fine however the other instance wont connect? I have tried the flush hosts again, created a new user with full access tot he tables and database.
Any suggestions?
0
Comment
Question by:monitorwa
  • 3
  • 2
5 Comments
 
LVL 24

Expert Comment

by:johanntagle
ID: 37794619
mysql Access denied for user 'username' '@'%' to database databasename

Are there really two quote characters after the username above?  Because if the same account from the same host connects fine using ODBC then what needs to be checked is the application, and if the application tries to connect with an extra single quote character, it may be the source of the error.
0
 

Author Comment

by:monitorwa
ID: 37794633
Hi johan,
The same application is connecting using the same user from several other pc's, in fact until yesterday this PC also connected fine without any error?
Its as if the server has somehow blocked this PC from having access, I have tried the flush-hosts for user root but it hasnt helped? I wonder if I need to try the flush-hosts for this specific user even though I have actually created and changed the ODBC connection to this new user?
0
 
LVL 24

Accepted Solution

by:
johanntagle earned 500 total points
ID: 37794638
Okay so you are saying even basic connection tests from that host fail, not just from the application?  Using a mysql admin/root account can you do a "show grants for username" to see if correct privileges are configured?
0
 

Author Comment

by:monitorwa
ID: 37794651
Hi Johan,
The user isnt the sharpest tool in the shed so Im pretty limited on what they can test but the application uses an ODBC connection but fails when run as per the details above, if I have the user go to the ODBC connection and run a test on the connection it connects fine, the user doesnt have any other MYSQL tools installed so I can get them to try connecting any other way.
I have set the privileges to grant access to everything but it still fails - funny thing is that the same user is fine from the other installations of this application so I think that shows the actual user privileges are fine. Any other suggestions?

thanks

Dave
0
 

Author Closing Comment

by:monitorwa
ID: 37794677
Hi Johan,
thanks for your help and suggestions - it turns out that someone must have fiddled over the weekend and the ODBC connection name had been change to have a space in front, bit of a weird error message but all sorted now so thanks again for your help
dave
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now