1: Set the MySQL configuration file/etc/mysql/my.cnf find bind-address =127.0.0.1 to comment out;//function is to make it no longer allow only local access; restart Mysql:/etc/init.d/mysql Restart 2: Log in to MySQL database: mysql-u root-p mysql> use MySQL; Query the host value:mysql> select User,host from user; If there is no "%" of this host value, the following two sentences are executed:
mysql> Update user set host= '% ' where user= ' root ';
mysql> flush privileges; or you can do: Mysql>grand all privileges on * * to [e-mail protected] '% ' identifies by ' XXXX '; Where the first * represents the database name, the second * indicates the table name of the database, and if the *. *, as above, indicates that all the tables are allowed access to the database; '% ': Represents the IP address allowed to access MySQL, and of course you can configure it to be specific to the IP name;% indicates that all IPs are accessible; Back to ' xxxx ' for the root user's password, for example:
Any host connected to the MySQL server with user root and password mypwd
Mysql> GRANT All privileges on * * to ' root ' @ '% ' identified by ' mypwd ' with GRANT OPTION;
mysql> flush Privileges;
Hosts with IP 192.168.1.102 connect to MySQL server with user myuser and password mypwd
Mysql> GRANT All privileges on * * to ' myuser ' @ ' 192.168.1.102 ' identified by ' mypwd ' with GRANT OPTION;
mysql> flush Privileges;