2 Answers
2

Privileges in MySQL are tied to both a 'username' and a 'host'. The host can be a domain name, an IP address or 'localhost'. Any of these can include the wildcard %. If you connect from the wrong place, even with the right username and password, you will still get a permission denied error.

Each of these different users can have different access to different databases, tables, rows and commands.

It's also worth noting that '127.0.0.1' is not the same as 'localhost' as using the mysql client on the command line will use the socket rather than IP to connect. If you want to use IP to connect when using the mysql client on the MySQL server, you can specify -P <IP address>.