1 . 查看本机是否可以ping通MySQL服务IP地址:
2 . 查看MySQL是否允许远程连接:
mysql -uroot -p mysql> show databases; mysql> use mysql; mysql> select host, user from user;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; #任何远程主机都可以访问数据库 mysql> FLUSH PRIVILEGES; #需要输入次命令使修改生效 mysql> EXIT #退出
mysql> use mysql; mysql> update user set host = '%' where user = 'root'; mysql> select host, user from user;
上一篇:【Mysql】mysql命令大全