Solution MySQL does not allow remote access to the method
1. Change Table method. Your account may not be allowed to log in remotely, only in localhost. This time as long as the computer in localhost, login mysql, change the "MySQL" Database in the "User" table in the "host" item, from "localhost" renamed "%"
Mysql-u root-pvmwaremysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ';
Mysql>select host, user from user;
2. Authorization law. For example, you want to myuser use MyPassword to connect to a MySQL server from any host.
GRANT all privileges on *.* to ' myuser ' @ '% ' identified by ' MyPassword ' WI
TH GRANT OPTION;
If you want to allow the user to connect to the MySQL server from the IP-192.168.1.6 host, and use MyPassword as the password myuser
GRANT all privileges on *.* to ' myuser ' @ ' 192.168.1.3′identified by
' MyPassword ' with GRANT OPTION;
I used the first method, just started to find no, online check, less execution of a statement mysql>flush privileges
Make the changes take effect. It's okay.
mysql> use MySQL;
mysql> Update user Set host = '% ' where user = ' root ';
Mysql> Select Host, user from user;
mysql> flush Privileges;
Note:mysql> flush privileges; Make the changes take effect.
Remote connection to MySQL needs to be done
1. Enter MySQL, create a new user xuys:
Format: Grant permission on database name. Table name user @ Login host identified by "User password";
Grant Select,update,insert,delete on *.* to firstname.lastname@example.org identified by "xuys1234";
View the results and execute:
Select Host,user,password from user;
You can see that the Xuys user that you just created is already in the user table. The host field represents the hosts that are logged on, their values can be IP, or the host name is available, and changing the value of the host field to% means that the Xuys user can log on to the MySQL server on any client machine, and it is recommended that you set it to% at development time.
Update user Set host = '% ' where user = ' Xuys ';
./mysqladmin-u root-p pwd Reload
./mysqladmin-u root-p pwd shutdown
Remember: Any changes to the authorization table need to be reload, that is, step 3rd.
If you cannot connect from the client through the above 3 steps, insert a record in the DB table of the MySQL database by doing the following:
INSERT into DB values (' 192.168.88.234 ', '% ', ' xuys ', ' y ', ' y ', ' y ', ' y ', ' y ' ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y-axis ', ' y ', ' y ';
Update db Set host = '% ' where user = ' Xuys ';
Repeat the 2nd, 3 steps above.
The separation of the web from the MySQL database is a good choice to avoid the lack of web resources due to the large number of database queries consuming the CPU, while allowing the Web server's resources to do its utmost to provide browsing services, while the database server handles only database transactions alone.
I am not very familiar with the principle of this aspect, my practice is actually the following to say, very simple. We have better experience and skills to share.
Scope of application: have independent host permissions
Hardware configuration: Two servers, as for the specific server hardware configuration is not within the scope of this article
Where: A for the Web server (assuming IP is: 126.96.36.199), b for MySQL data server (assuming IP: 188.8.131.52)
To proceed to action:
1. Configure Web Services in Web Server A. There are a lot of articles on this. Suppose the IP of the Web server is: 184.108.40.206
2. Install MySQL service on database server B
3. Now the new version of the MySQL general default does not allow remote connection, the need to establish a remote connection account can be
Use the root account on the command line to enter MySQL
Mysql-u Root-p Pass
Choose to enter MySQL database
View all existing accounts and addresses
SELECT ' Host ', ' user ' from ' user ';
For example, mine is:
| Host | User |
| localhost | |
| localhost | PMA |
| localhost | Root |
3 Rows in Set (0.00 sec)
In other words, there are three (localhost) accounts that allow only local connections, respectively, ROOT,PMA, and empty users.
Now that you decide to have root have the permissions of the remote link on the Web server A above, that's it:
UPDATE ' user ' SET ' Host ' = ' 220.127.116.11 ' WHERE ' user ' = ' root ' LIMIT 1;
So 18.104.22.168 this Web server can be remotely connected to this database server, if you want any remote machine can connect to this database, you will change 22.214.171.124 to%, but do not recommend this, because you know!
If you want to create a new user New_user have access to remote links, that's it:
INSERT into ' user ' (' Host ', ' user ', ' Password ', ' select_priv ', ' insert_priv ', ' update_priv ', ' delete_priv ', ' creat E_priv ', ' drop_priv ', ' reload_priv ', ' shutdown_priv ', ' process_priv ', ' file_priv ', ' grant_priv ', ' References_priv ' , ' Index_priv ', ' alter_priv ', ' show_db_priv ', ' super_priv ', ' create_tmp_table_priv ', ' lock_tables_priv ', ' EXECUTE_PR IV ', ' repl_slave_priv ', ' repl_client_priv ', ' ssl_type ', ' ssl_cipher ', ' x509_issuer ', ' x509_subject ', ' max_questions ', ' max_updates ', ' max_connections ') VALUES (' 126.96.36.199 ', ' New_user ', PASSWORD (' New_user_password '), ' y ', ' y ', ' Y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ' y ', ', ', ', ', ', ', ', ', ', ' 0 ', ' 0 ', ' 0 ');
Change the New_user to the name you want, and the password is: New_user_password, of course, you can set it at your discretion.
When your database can be connected remotely, you can set the $dbhost variable for your MySQL database Server B IP in your Web server's forum config.inc.php:
$dbhost = ' 188.8.131.52 ';
In practice, it is best to have two machines in the same network section/firewall within the same computer room. Of course, if possible, it would be better to place the database server in a local area network on the Web server.
It's a little more concise:
Grant all on yourdb.* to Yourusername@yourhost identified by "YourPassword";
Flush privileges; Make permission effective immediately