1.先登录服务器的mysql
mysql -hlocalhost -uroot -p
2.需要对远程连接授权
grant all privileges on *.* to root@"%" identified by "password" with grant option; flush privileges;