Settings for MySQL remote connection

Source: Internet
Author: User

Sometimes the database machine is not the same machine as the project, then it involves the remote link database, the steps to configure the remote connection database are as follows:

1. View the information in the user table in MySQL database, for example, using use MySQL to switch to MySQL database, then using select Host, user from user lists all users and corresponding host addresses in the user table. Where host corresponds to the IP of the hosts allowed to access, "%" means that all IP is allowed to access the database, the user corresponds to the username, as shown in, the test user allows all IP to connect to this database, and the root user only allows access via local.

2, to give specific users a permission to the instructions

GRANT all privileges on * * to ' user_name ' @ ' host_name ';
FLUSH privileges;

The first instruction is to grant permission, and the second is to make the granted permission effective; the first instruction, *. * represents all the tables in all databases, and "Databasename.tablename" can be used to grant the appropriate object if the permissions for a particular table correspond to a particular database.

3, check the configuration file my.cnf, find bind_address This line, if this line is not commented out, and the corresponding address is the local address "127.0.0.1", then to comment out this sentence, or remote connection.

4, to the database users to change the password instructions

Update user set Password=password ("New password") where user= ' username ';

Settings for MySQL remote connection

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.