MySQL--remote access to MySQL's solution

Source: Internet
Author: User

1, change the table method may be your account is not allowed to login from the remote, only in localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host", from "localhost" to "%"
Code:mysql-u root-p123
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ';
Mysql>select host, user from user;

Note: In fact, we can add a user, the necessary permissions granted to this user, and the user's host set to%

2, Authorization Law 1, if you want to use "myuser" user "MyPassword" password from any host to connect to the MySQL server. SQL code:
 grant  all  privileges  on  * . *  to    myuser   " @"  %    Identified by   mypassword     with  grant  option    FLUSH  privileges ; 
Example 2, if you want to allow users to myuser from the IP 192.168.1.6 host to the MySQL server, and use MyPassword as the password SQL code:  
GRANT  All Privileges  on *. *  to ' MyUser '@'192.168.1.3'by  'mypassword '  with GRANT OPTION ;   
FLUSH privileges;

Note: Different system host will produce different results, 1:windows under the general in accordance with one of the above operations can be; 2, for the Linux environment, just follow the above steps are not enough, the specific steps are as follows:

Find the appropriate configuration file for your MySQL installation directory/etc/mysql/my.cnf
Comment out "bind-address = 127.0.0.1"

MySQL--remote access to MySQL's solution

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.