How to enable remote connection (multiple backups) for MySQL database _ MySQL

Source: Internet
Author: User
Multiple backup servers must be able to remotely connect to your database when backing up your database. However, mysql is usually disabled during installation. Therefore, you need to enable the remote access permission for the mysql database. To enable this function, pay attention to the following three points to enable the MySQL remote login account:

1. check whether the firewall on the server does not block port 3306.
The default port of MySQL is 3306. make sure that the firewall does not block port 3306. Otherwise, the remote connection to MySQL cannot be established through Port 3306.

If you specify another port when installing MySQL, enable the port used by MySQL in the firewall.

If you do not know how to set up a firewall on your server, contact your server administrator.

2. make sure that the dongle and so on do not intercept the IP address of our backup server

If your server has installed dongle and other security software, please add our backup server IP address 115.28.36.60 and other backup server IP addresses to the White List.

3. added support for remote connection to MySQL Users and authorization.

1) log on to the server and enter the command line.
On a Windows host, click the Start menu, run, and enter "cmd" to enter the command line.

2) log on to the mysql console with the database administrator account. Run mysql-u root-p on the command line and enter the password to enter the mysql console.
Example: MySQL-uroot-p123456

123456 is the password of the root user.

3) Create a remote login user and authorize the user. continue to execute the following statement on the console.
Grant select, lock tables on demodb. * to deoffset @ '1970. 28.36.60 'identified by 'Your password ';

Explanation: demodb = database name; deshortname = database username; your password = database password

For example:

Grant select, lock tables on discuz. * to ted @ '1970. 28.36.60 'identified by '123 ′;

4) after the preceding statement is executed, the following statement can take effect immediately.
Flush privileges;

Explanation:

Grant select, lock tables on discuz. * to ted @ '1970. 28.36.60 'identified by '123 ′;

The preceding statement authorizes the select and locked permissions of the discuz database to the ted user, allows the ted user to remotely log on to the IP address 115.28.36.60, and sets the ted user password to 123456.

Discuz. * indicates the table to which the preceding permission applies. discuz indicates the database, and * indicates all the tables. Therefore, we can infer that: authorize "*. * ", authorize all tables of a database to" database name. * ", Grant permissions to a table in a database as" database name. table name ".

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

115.28.36.60 indicates the IP address that allows remote connection. if you want to restrict the IP address, set it to "%.

Note:

115.28.36.60 is an IP address of our backup server. it is mainly used to test whether our server can connect to your database.

Many of you may have questions about whether it will be unsafe. In fact, don't worry, because first, you only authorize our servers to connect to your database. second, our server only has the select and lock permissions, that is, the query and lock table permissions, so you cannot change your database.


If you are not at ease, you can execute select host, user from user on the mysql console; check the content in the user table, because the user who enables mysql remote logon is stored in the user table in the mysql database.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.