access denied when mysql to localhost using public ip
If you want to login to MySQL on the local machine using the IP address do this

mysql -u cgao -h xx.xxx.xxx.xxx -P3306 --protocol=tcp -p


This force a TCP/IP connection locally