Http://blog.chinaunix.net/uid-23215128-id-2951624.html
# Mysql-uroot
Mysql> UseMySQL;DatabaseChangedmysql> SELECT' Host ', 'User` from`User`;+-----------+--------+|Host| User |+-----------+--------+| 127.0.0.1 |Houtai|| 127.0.0.1 |Root||::1 |Root||localhost|Houtai||localhost|Root|+-----------+--------+5Rowsinch Set(0.00sec) MySQL> UPDATE`User`SET' Host '= '%' WHERE`User`= 'Root'LIMIT1; Query OK,1Row affected (0.00sec) Rows matched:1Changed:1Warnings:0MySQL> SELECT' Host ', 'User` from`User`;+-----------+--------+|Host| User |+-----------+--------+| % |Root|| 127.0.0.1 |Houtai|| 127.0.0.1 |Root||::1 |Root||localhost|Houtai|+-----------+--------+5Rowsinch Set(0.00sec) MySQL>FlushPrivileges;
Write a PHP script test remotely:
<? PHP $con Mysqli_connect ("IP", "root", "password"); if (! $con ) { diemysql_error()); Else echo"Connect ok!"? >
Server to shut down firewall: iptables-f (service iptables stop)
Display: Connect ok!
PHP Remote connection MySQL