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
Solved

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

Posted on 2012-04-01
5
321 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

791 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