Solution:
1. Change the table.
It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log in to MySQL on the computer of localhost, and change the "host" entry in the "user" table in the "MySQL" database to "%" from "localhost"
CopyCode The Code is as follows: mysql-u root-pvmwaremysql> use MySQL;
Mysql> Update user set host = '%' where user = 'root ';
Mysql> select host, user from user;
2. Authorization method.
for example, If you want myuser to use mypassword to connect to the MySQL server from any host.
grant all privileges on *. * To 'myuser' @ '%' identified by 'mypassword' with grant option;
flush privileges;
If You Want To allow myuser to connect to the MySQL server from a host with IP address 192.168.1.6 and use mypassword as the password
grant all privileges on *. * To 'myuser' @ '192. 168.1.3 'identified by 'mypassword' with grant option;
flush privileges;
if you want to allow the user myuser to connect to the DK database of the MySQL server from a host with the IP address 192.168.1.6, use mypassword as the password
grant all pridrop Eges on DK. * To 'myuser' @ '192. 168.1.3 'identified by 'mypassword' with grant option;
flush privileges;
I used the first method. I found it was unavailable at first. I checked it online, run the following statement: mysql> flush rivileges to make the modification take effect.
another method, but I have not tried it myself. You can find it on csdn.net.
RUN MySQL on the machine where MySQL is installed:
1. D: \ mysql \ bin \> mysql-H localhost-u root // enter the MySQL server
2. mysql> grant all privileges on *. * To 'root' @ '%' with grant option // grant data access permissions to any host
3. m Ysql> flush privileges // modification takes effect
4. mysql> exit // exit MySQL server
so that you can log on as root on any other hosts!