Mysql remote access to bitsCN.com
The database installed on the local machine can be accessed by a local program, but the machine of the colleague cannot be connected. it is found that remote access is not enabled for the mysql database.
The solution is as follows:
----------------------------------------------------------------
My database mysql root user password = cx, enter mysql-u root to enter mysql
To allow remote access to mysql, you can use the following methods:
A. change the table.
Java code
Use mysql;
Update user set host = '%' where user = 'root ';
Select host, user from user;
B. authorization.
For example, the root user can connect to the mysql server from any host.
Java code
Grant all privileges on *. * TO 'root' @ '%' identified by 'cx 'with grant option;
If the user test is allowed to connect to the mysql server from a host with the ip address 10.40.207.17, and use cx as the password
Java code
Grant all privileges on *. * TO 'test' @ '10. 40.207.17 'identified by 'cx' with grant option;
Lush rivileges;
C: run the following command on the machine where mysql is installed:
// Enter the MySQL server
Java code
Mysql-h localhost-u root
/Grant data access permissions to any host
Grant all privileges on *. * TO 'root' @ '%' WITH GRANT OPTION
// Make the modification take effect
FLUSH PRIVILEGES
// Exit the MySQL server
EXIT
Author: "Two Sesame Seeds"
BitsCN.com