When connection to a mysql you can either connect by a TCP/IP connection or through a socket.
If you are connection though a socket the host value for the connecting user will always be 'localhost'. When using TCP/IP the host will always be '127.0.0.1'.
This is very important when specifiying privileges. If you allow a user to connect from 127.0.0.1 ('user'@'127.0.0.1') this user will not be able to connection through sockets:
# mysqladmin --user=zabbix_agent --password=xxx ping
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'zabbix_agent'@'localhost' (using password: YES)'
mysql> show grants for 'zabbix_agent'@'127.0.0.1';
+----------------------------------------------------------------------------------------------------------------------------------+
| Grants for zabbix_agent@127.0.0.1 |
+----------------------------------------------------------------------------------------------------------------------------------+
| GRANT REPLICATION CLIENT ON *.* TO 'zabbix_agent'@'127.0.0.1' IDENTIFIED BY PASSWORD '*xxx' |
+----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Note that the mysql client will automatically use a socket if you use -h localhost (default). So if you pass -h 127.0.0.1 things will work:
# mysqladmin -h 127.0.0.1 --user=zabbix_agent --password=x ping
mysqld is alive