Solution:
1. Table change method.
It may be your account does not allow remote login, only localhost. This time as long as the localhost that computer, log in mysql, change the "mysql" database "user" table in the "host" entry from the "localhost" renamed the "%"
mysql -u root -pvmwaremysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;
2. Authorization Act
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 user myuser to connect to the mysql server from a host whose ip is 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 user myuser to connect to the mysql server's dk database from the host where ip is 192.168.1.6 and use mypassword as the password
GRANT ALL PRIVILEGES ON dk. * TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
I use the first method, the beginning not found, check on the Internet a little less implementation of a statement mysql> FLUSH RIVILEGES so that the changes take effect.
Another way, but I have not personally tried, looking for in the csdn.net, you can look at.
On the machine where mysql is installed:
1, d: mysqlbin> mysql-h localhost-u root / / This should be able to enter the MySQL server
2, mysql> GRANT ALL PRIVILEGES ON *. * TO 'root' @ '%' WITH GRANT OPTION / / give any host access to the data
3, mysql> FLUSH PRIVILEGES / / modify the entry into force
4, mysql> EXIT / / exit the MySQL server
So that you can log in as root on any other host!