1

I have created a user and given that user full access, but MySQL is still denying access to that user - why?

Create user:

create user 'myUser'@'Mikes-MacBook-Air.local' identified by 'account_password' 

Grant privileges to all databases:

grant all privileges on *.* to 'myUser'@'Mikes-MacBook-Air.local' identified by 'account_password' with grant option

Verified grant:

show grants for 'myUser'@'Mikes-MacBook-Air.local'

MySQL is running (verified) on a machine with IP 192.168.0.2 and the client is connection from a machine with IP 192.168.0.3. I have even created a user account with the ip as the domain:

Create user:

create user 'myUser'@'192.168.0.3' identified by 'account_password' 

Grant privileges to all databases:

grant all privileges on *.* to 'myUser'@'192.168.0.3' identified by 'account_password' with grant option

Verified grant:

show grants for 'myUser'@'192.168.0.3'

I have rebooted both machines and verified IP addresses did not change and that MySQL is running. I can access this MySQL server from Workbench w/o issue from the same client machine - different credentials though. I can also access this MySQL instance from another remote client machine, where user has similar MySQL account with other computer domain.

After all this, I still get the exception:

Exception: Access denied for user 'myUser'@'Mikes-MacBook-Air.local' (using password: YES)

Why is MySQL denying access?

Roy Hinkley
  • 527
  • 4
  • 13
  • 20

2 Answers2

0

It's trying to connect using the username 'Mikes-MacBook-Air.local' instead of 'myUser'. What is the exact command you're using to connect when you're receiving the error message?

David King
  • 476
  • 2
  • 6
  • I am connecting through a java connection - which does work from another machine - I am just trying to do it from a new machine now. – Roy Hinkley Nov 05 '15 at 16:32
  • Can you share your java connection code? Given that the username is wrong I'm guessing that's where the issue is. – David King Nov 06 '15 at 17:27
  • The username is/was not wrong. It turns out the way the MacBook Air was identifying itself on the network, with uppercase was causing the issue. Renaming my computer and updating the MySQL user credentials resolved the issue. So, case sensitivity was the issue. – Roy Hinkley Nov 06 '15 at 21:54
0

do you have skip-resolv in your my.cnf ? If so MySQL will not check ACL with hostnames.

In general, avoid using hostnames in MySQL ACL and always use IP or network. Then add skip-resolv in your configuration, you will have better connection performance.

mick
  • 735
  • 6
  • 7