Send Yun sensor data to MySQL on external server

Help!! Yun can't connect to mysql. How can i solve it?

mysql -u temp -h localhost -p

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld.sock' (146)