Current location - Quotes Website - Team slogan - How to open a remote connection (multiple backups) in MySQL database _MySQL
How to open a remote connection (multiple backups) in MySQL database _MySQL
Open MySQL remote login account need to pay attention to the following three points:

1. Make sure that the firewall on the server does not block port 3306.

The default port of MySQL is 3306, so it is necessary to ensure that the firewall does not shield port 3306, otherwise the remote terminal cannot connect to MySQL through port 3306.

If you specified another port when installing MySQL, please open the port number you specified for MySQL in the firewall.

If you don't know how to set up a firewall on your server, please consult your server administrator.

2. Make sure that the security dog has not intercepted our backup server IP.

If security software such as security dog is installed on your server, please add our backup server IP 1 15.28.36.60 to the white list.

3. Allow MySQL users to connect remotely and authorize.

1) Log in to the server and enter the command line.

In the Windows host, click the Start menu, run, enter "cmd" and enter the command line.

2) Use the database administrator account to enter the mysql console. Execute the mysql -u root -p password at the command line, and then enter the mysql console.

For example: MySQL-urot-p 123456.

123456 is the password of the root user.

3) Create a remote login user and authorize it to continue to execute the following statements on the console.

Grant select, lock the table on demodb. * Demonstrate the user identified by "Your Password" @'115.28.36.60';

Explanation: demodb= database name; Demouser= database user name; Your password = database password.

For example:

Grant select to lock the table on discuz. * to ted @'115.28.36.60' marked by' 123456';

4) After the above statement is executed, the following statement will take effect immediately.

Refresh permissions;

Bian Xiao explained:

Grant select to lock the table on discuz. * to ted @'115.28.36.60' marked by' 123456';

The meaning of the above statement is to authorize the selection and locking authority of discuz database to ted users, allow ted users to log in remotely at the IP of 1 15.28.36.60, and set the password of ted users to 123456.

Discuz。 * indicates which table the above permission is for, discuz refers to the database, and the following * indicates all tables, so it can be inferred that all tables in all databases are authorized as "*". * ",all tables of a database are authorized as" database name. * ",a table of a database is authorized as" database name. Table name ".

Ted indicates which user you want to authorize. The user can be an existing user or a non-existing user.

1 15.28.36.60 indicates the IP address that allows remote connection. If you want to limit the IP of the link, just set it to "%".

note:

1 15.28.36.60 is one of our backup server IP, which is mainly used to test whether our server can connect to your database.

Many friends here will have questions about whether this is unsafe. Don't worry, because first of all, you only authorize our server to connect to your database. Secondly, our server only has the permissions of select and lock, that is, the permissions of querying and locking tables, so you can't change your database at all.

If you are not at ease, you can execute select host in mysql console and user from user to check the contents of user table. Because all users who open mysql remote login are stored in the user table of mysql database.