Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

I face the same issue. My build works well, but in recent days, when it runs in xenial as default, I always get error messge:

amysqladmin: connect to server at ‘localhost’ failed

for command mysqladmin create woocommerce_test --user=root --password= --host=localhost --protocol=tcp

My solution is force it use trusty by add dist:trusty into .yml file. But if there’s any way to make it work in xenial, please let me know.