可能是MySQL没有对你要连上的IP地址(主机)进行授权吧
grant all on *.* to 'root'@'IP' identified by 'password';
然后,再连连看行不行