标签:
http://blog.chinaunix.net/uid-23215128-id-2951624.html
# mysql -uroot
mysql> use mysql; Database changed mysql> SELECT `Host`,`User` FROM `user`; +-----------+--------+ | Host | User | +-----------+--------+ | 127.0.0.1 | houtai | | 127.0.0.1 | root | | ::1 | root | | localhost | houtai | | localhost | root | +-----------+--------+ 5 rows in set (0.00 sec) mysql> UPDATE `user` SET `Host` = ‘%‘ WHERE `User` = ‘root‘ LIMIT 1; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> SELECT `Host`,`User` FROM `user`; +-----------+--------+ | Host | User | +-----------+--------+ | % | root | | 127.0.0.1 | houtai | | 127.0.0.1 | root | | ::1 | root | | localhost | houtai | +-----------+--------+ 5 rows in set (0.00 sec) mysql> flush privileges;
远程写个PHP脚本测试:
<?php $con = mysqli_connect("IP","root","密码"); if (!$con) { die(‘Could not connect: ‘ . mysql_error()); } else echo"connect ok!" ?>
服务器要关闭防火墙: iptables -F (service iptables stop)
显示: connect ok!
标签:
原文地址:http://www.cnblogs.com/carbon3/p/5964387.html