How can I login to MySQL as or ::1 instead of localhost?

I’ve set different password for 'root'@'localhost' and 'root'@'127.0.01' like this:

mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pswd1');
SET PASSWORD FOR 'root'@'' = PASSWORD('pswd2');

but when I try to login like this:

mysql -u root -p -h

I still have to use the first password pswd1 even though according to this:

enter image description here

another password pswd2 was set for

What is the problem here? How can I set 3 different passwords for ‘root’@’localhost’, ‘root’@’’ and ‘root’@’::1′ and login to those accounts with those passwords?

Go to Source
Author: JConstantine