Mysqladmin can't connect to database

Having issues trying to get phpunit up and running on a Local install. Using wp-cli to scaffold tests (https://make.wordpress.org/cli/handbook/plugin-unit-tests/#running-tests-locally) and when I run bin/install-wp-tests.sh wordpress_test root root localhost latest mysqladmin can’t connect to the server:
mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'127.0.0.1' (using password: YES)'

Running v2.2.4 and my site’s environment is the “Preferred 1.1” nginx, php 7.1.7, mySQL Version 5.6.37

Any help is appreciated.

A bit more info. I was getting some help from some colleagues and we may have tracked it down - but still not sure why it’s happening or how to fix it.

I can successfully connect with
mysql -u root -proot -h localhost
but not with
mysql -u root -proot -h 127.0.0.1