Mysql sets the specified ip address to remotely access the connected instance, and mysql Remote Access
This example describes how to set up a remote access connection from a specified ip address in mysql. The specific implementation method is as follows:
1. Authorize the User root to use the password jb51 to connect to the mysql server from any host:
Copy codeThe Code is as follows: grant all privileges on *. * TO 'root' @ '%' identified by 'jb51 'with grant option;
Flush privileges;
2. Authorize the root user to use the jb51 password to connect to the mysql server from the host with the specified ip address 218.12.50.60:
Copy codeThe Code is as follows: grant all privileges on *. * TO 'root' @ '2017. 12.50.60 'identified by 'jb51' with grant option;
Flush privileges;
I hope this article will help you design MySQL database programs.
How to enable MySQL to allow remote connection
1. Go to MySQL and create a new user root. The password is root. Format: grant permission on Database Name. table name to user @ login host identified by user password; 1. grant select, update, insert, delete on *. *
Identified by root; original data table structure 1. mySQL use MySQL; 2. database changed 3. mySQL select host, user, password from user; 4. + ----------- + ------ + --------------------------------------------- + 5. | host | user | password | 6. + ----------- + ------ + --------------------------------------------- + 7. | localhost | root | * 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 8. + ----------- + ------ + ------------------------------ ------------- + Result 1 after the preceding statement is executed. mySQL use MySQL; 2. database changed 3. mySQL select host, user, password from user; 4. + -------------- + ------ + --------------------------------------------- + 5. | host | user | password | 6. + -------------- + ------ + --------------------------------------------- + 7. | localhost | root | * 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 8. | 192.168.1.12 | root | * 81F5E21E35407D884A6CD 4A731AEBFB6AF209E1B | 9. + ---------------- + ------ + ------------------------------------------- + 10. 2 rows in set (0.00 sec) you can see that the root user you just created already exists. The host field indicates the Host to log on to. The value can be an IP address or a host name. (1) If you want to log on with a local IP address, you can change the Host value to your own Ip address. 2. Implement MySQL remote connection (authorization). Changing the host field value to % indicates that you can log on to the MySQL server as a root user on any client machine. We recommend that you set the value to % during development. 1. update user set host = '%' where user = 'root'; change the permission to all privileges 1. mySQL use MySQL; 2. database changed 3. mySQL grant all privileges on *. * toroot @ '%' identified by root; 4. query OK, 0 rows affected (0.00 sec) 5. mySQL select host, user, pa ...... remaining full text>
How can I grant a remote IP address access permission to a MYSQL database?
Your MYSQL database contains a database named mysql, which contains a table named user. You can check the structure and existing data of the table, you will know what to do. For example, you can add a piece of data, and the IP address specified by the Host for you, the user can be %, and the password doesn't matter, the corresponding permissions (all can be Y) are set later, so that the machine can connect to the database regardless of the user and password, and has the permissions you specified.
Be patient. I believe you will understand it at a glance.
Reference: blog.chinaunix.net/u2/73743/showart_1094545.html