Connect remotely to mysql server

If you are a web developer and working with mysql then once in while you have done this.

Connect to remote mysql server

mysql -u root -h 'any ip address here' -p

Sometime you will get the following error.

ERROR 1130 (00000): Host ''xxx.xx.xxx.xxx'' is not allowed to connect to this MySQL server

How to resolve this(by creating new administrator account on remote mysql-server)
login to mysql and run following commands.

CREATE USER 'openvani'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'openvani'@'localhost WITH GRANT OPTION;
CREATE USER 'openvani'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'openvani'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Now you can connect with remote mysql with following command.

 mysql -u openvani -h 'any ip address'-p

Still having troubling in login to remote mysql. Please comment, always ready to make web better.
Cheers,