first, connect to the remote database:1. Display Password
For example: MySQL connection remote Database (192.168.5.116), port "3306", username "root", password "123456"
c:/>mysql-h 192.168.5.116-p 3306-u root-p123456 2. Hidden password
such as: MySQL connection to the local database, the user named "root",
c:/>mysql-h localhost-u root-p
Enter Password:Second, configure MySQL to allow remote linksby default, the MySQL account is not allowed to log on remotely, only on localhost. This article provides two ways to set up MySQL to connect through a remote host. I. Change of table Method
After localhost log in MySQL, change "host" in "User" table in "MySQL" database, rename "localhost" to "%"
For example:#mysql-u root-p Enter Password:...mysql>
mysql>Update user set host = '% ' where user = ' root ';
mysql>Select Host, user from user;
Ii. The law of authorization
For example: you want to myuser use MyPassword (password) from any host to connect to the MySQL server.
Mysql>Grant all privileges on * * to ' myuser ' @ '% ' identified by ' MyPassword ' with GRANT OPTION;
If you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.6 and use MyPassword as the password
Mysql>GRANT All privileges on * * to ' myuser ' @ ' 192.168.1.3 ' identified by
' MyPassword ' with GRANT OPTION;
Mysql>FLUSH Privileges
Make the changes effective, you can.
FAQ:
1, after using the Law II authorization method, cannot log on to MySQL locally (for example: #mysql-u root-p-H 192.168.5.116
Enter Password: &NBSP
ERROR 1045 (28000): Access denied for user ' root ' @ ' loadb116 ' (using Password:yes)
In the example above loadb116 is the hostname.
Workaround:
1, this time can be used: MySQL -u root-p login, enter after MySQL.
Mysql> grant all privileges on *. * to ' root ' @ ' loadb116 '
& nbsp identified by ' 123456 ' with GRANT option;
Query OK, 0 rows Affected (0.00 sec)
Mysql> flush privileges;
Query OK, 0 rows Affected (0.00 sec)
2, log on locally using the IP address
# mysql-u root-p-H 192.168.5.116
Enter password:
Welcome to the MySQL monitor. Commands end with; or/g.
Your mysq L Connection ID is a
server version:5.1.45 MySQL Community Server (GPL)
Type ' help; ' or ' H ' for help. Type '/C ' to clear the buffer.
Mysql> To connect a remote database with a tool:2. Enter information for the remote database, such as