How to allow remote connections on MySQL server

Open your ssh shell and launch the following command:

root@localhost# mysql –p

 Insert the mysql root password, then launch the following commands:

select host, user, password from mysql.user;

You will have the following message:
Setting privileges for remote connection:
Then write the following:

Grant all on *.* to ‘root’@’%’ identified by ‘yourmysqlpassword’;
Flush privileges;

That's it! This command gives access to all tables, to user root, connecting from any ip address.
 If you need to grant this privileges to other existing users, simply change the users or the mask after @.