0

I would like to use the command below to connect to my Mac's local database (xx.xxx.xxx.xxx is the Mac's ip address)

mysql -u cgao -h xx.xxx.xxx.xxx -p

and I got the error message:

ERROR 1045 (20000): Access denied for user 'cage'@'dhcp-xx-xxx-xx-xxx.dyn.mycompany.com' (using password: YES)

But it will succeed when I enter the same command in another computer. How can I solve it? Can I only use localhost or 127.0.0.1 to local machine?

I feel it is somehow related to the dynamic ip address in my company. But I didn't find the exact answer on the web. Can someone elaborate the reason and share suggestions?

1 Answer 1

1

If you want to login to MySQL on the local machine using the IP address do this

mysql -u cgao -h xx.xxx.xxx.xxx -P3306 --protocol=tcp -p

This force a TCP/IP connection locally

1
  • Thanks @RolandoMySQLDBA . Does this have any speed issue?
    – cgao
    Mar 14, 2015 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.