in reply to Canot connect to the remote mysql server through those lines

Could it be that the MySQL setup on the remote host differs from that of your 'test server'? Have you checked that /var/run/mysqld/mysqld.sock exists? Have you checked MySQL is up and running with this socket? Try something like show variables like 'socket'; within a MySQL session? For further tips I would suggest reading the documentation.

Martin