?
Solved

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

Posted on 2012-04-01
5
Medium Priority
?
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 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