Do the site, to update the database frequently, contact with the database is certainly MySQL. Sometimes when building a station because the database and Web site in different IP, this time need to use the program for MySQL remote connection, and MySQL because of security factors, the default time user set is not remote connection, only local connection, this time you need to modify the settings. Here is a small part of the introduction of the Operation method.
Enter cmd command mode.
Mysql-h Localhost-u Mysql-p
Enter Password: ******
Connect to the database.
mysql> use MySQL; (This DB holds various configuration information for MySQL)
Database changed
Mysql> select Host,user from user; (View the user's permission condition)
+-------------+-------+
| Host | user |
+-------------+-------+
| localhost | |
| localhost | Root |
| localhost | |
| localhost | MySQL |
+-------------+-------+
6 rows in Set (0.02 sec)
As you can see, you can only access it as a host of localhost.
Mysql> Grant All privileges on * * to ' root ' @ '% ' identified by ' password ' with Grant option;
(% means all external machines, if a certain machine is specified, the% is changed to the corresponding machine name; "root" means the username to be used, and the password needs to be changed to the root password)
mysql> flush Privileges; (Run as a sentence to take effect, or restart MySQL)
Query OK, 0 rows affected (0.03 sec)
Mysql> select Host,user from user; (see user's permissions again)
+-------------+-------+
| Host | user |
+-------------+-------+
| % | MySQL |
| % | Root |
| localhost | |
| localhost | Root |
| localhost | |
| localhost | MySQL |
+-------------+-------+
Mysql>exit
Now try again: from the remote CMD to see if you can log in, can log in, the general code is also can be connected to.
Turn on the local MySQL database remote connection