After MySQL is installed, only the following hosts are recognized: localhost and 127.0.0.1. After MySQL is installed, only the following hosts are recognized: localhost and 127.0.0.1, if you want to allow the IP address on your machine to log on normally, there are two methods:
First, authorize your IP address 172.16.1.10
Grant privileges on dbname. * to "user" @ "172.16.1.10" identified by "password ";
If you only use it, you can write it like this.
Grant all on *. * to "user" @ "172.16.1.10" identified by "password ";
For more information about grant, see the mysql User Manual.
Mysql> use mysql; database changed
Mysql> desc user; check the number of fields mysql> insert into user values (val1, val2 ,....);
The second is to set the root user to be able to log on remotely, that is, to log on from any machine.
Mysql> use mysql;
Database changed
Mysql> update user set host = "%" where user = "root ";
Mysql> use mysql
Grant all on *. * to "root" @ "172.30.41.72" identified by "x0000304 ";
Restart mysql server
Method 3: run the following command directly in the mysql database management background:
Use mysql;
Grant all on *. * to "root" @ "172.30.41.95" identified by "x0000304 ";