mysql -u root -p 
mysql>use mysql; 
mysql>select ‘host‘ from user where user=‘root‘; 
mysql>update user set host = ‘%‘ where user =‘root‘; 
mysql>flush privileges; 
mysql>select host,user   from user where user=‘root‘; 重起mysql服务即可完成。
grant all privileges on . to ‘root‘@‘%‘ identified by ‘password‘ with grant option;
原文:http://blog.51cto.com/xiaoahehe/2178794