Im in Ubuntu 16.04.5 LTS
if I do mysql -h localhost -u root
I can connect with no issues. But if I do, mysql -h 127.0.0.1 -u root
I get:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
How do I fix this?
Im in Ubuntu 16.04.5 LTS
if I do mysql -h localhost -u root
I can connect with no issues. But if I do, mysql -h 127.0.0.1 -u root
I get:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
How do I fix this?
MySQL considers 127.0.0.0/8
addresses to be different from localhost
so when creating users if you specify one you need to connect using that one reference.
Additionally, some MySQL connectors will use a socket when connecting to localhost
but use TCP/IP when connecting to 127.0.0.1
Finally, one of the more recent differences is if localhost
is used socket authentication is done - if you are logged in as the root user, you can be logged in to MySQL w/o a password. Played silly buggers with some backup scripts I wanted to run via cron
when I first found that one...