MySQL cannot remotely access the processing method

Source: Internet
Author: User

Problem: MySQL permissions are set correctly, but still cannot be accessed remotely. The 3306 port was not opened by Telnet.

Analysis: MySQL defaults to bind only 127.0.0.1, that is, only on this computer to access Port 3306.

In Linux

Workaround: Locate the MySQL profile, search for "bind-address" and find this line:

Bind-address = 127.0.0.1//The remote IP address can be bound here

Add a # to the front, comment out the line, save, and restart MySQL. Again, remote access is available, and Telnet can discover that the port is also open.


1. Change Table method.

Your account may not be allowed to log in remotely, only in localhost. This time as long as the computer in localhost, login mysql, change the "MySQL" Database in the "User" table in the "host" item, from "localhost" renamed "%"

The code is as follows Copy Code

Code:mysql-u root-p123
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ';
Mysql>select host, user from user;

If you want to specify the host can be a way we can bind

You want to specify 1 IP remote access MySQL that has been executed locally

The code is as follows Copy Code

Mysql>grant all privileges on. To user1@ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION;

Mysql>flush privileges;

And the local firewall has opened the MySQL port, why remote with $mysql-h192.168.1.2-u user1-p
Can't access it?

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.