Connecting mysql to a different server

When I tried to connect to a different server it says error with the database, then I tried to connect using linux command line then an error occured

ERROR 1130 (HY000): Host ‘xxx.xx.xxx.xxx’ is not allowed to connect to this MySQL server

then found out that I need to make a user with priviledge and allow to certain domain / all.

mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;

Good explanation
http://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server