Problem solving for remote connection to MySQL database

Source: Internet
Author: User

Problem description

Out of interest, I have MySQL servers and clients installed on both the Windows and Ubuntu systems. Now there are some preliminary information:

    • IP address of Windows system: 192.168.5.196
    • Ubuntu System IP Address: 192.168.5.228

Now I'm trying to connect the Ubuntu Terminal host remotely on Windows.
First, configure MySQL access on the remote Ubuntu host, as follows:

Mysql> Grant all privileges the ' longlong ' @ '% ' identified by ' 123456 ';

Now, check the MySQL permissions information on the Ubuntu host as follows:

Now, telnet to the Ubuntu host MySQL database on Windows, the result is:


have been quoted this error!

Problem Solving Methods

After csdn ask to ask this question, tried everyone's suggestions, such as through the Mysql-u xx-p xxxx-h xxxx or shut down the Windows Firewall and through the UFW Disable command to shut down the Ubuntu firewall, still cannot solve this problem.
Later, I learned that on Ubuntu, MySQL was configured throughout MySQL via the/ETC/MYSQL/MY.CNF configuration file. Excerpt one or two:

[Mysqld]
3306 Port =
Basedir =/usr
DataDir =/var/lib/mysql
Tmpdir =/tmp
# Instead of skip-networking The default is now-listen only
# on localhost which are more compatible and are not less secure.
Bind-address = 127.0.0.1

Note that in the above configuration file, there is a sentence for the configuration command:

Bind-address = 127.0.0.1

This command indicates that the Ubuntu host is listening locally and processing only local connection requests.
We can also use the netstat command to view the relevant port listening information:

Shell> NETSTAT-ANP | grep 3306
Output> TCP 127.0.0.1:3306 LISTEN

Now, we comment out the MY.CNF bind-address statement and restart the MySQL service:

shell> sudo service MySQL restart
output> MySQL stop/waiting mysql start/running, process 25765

Now, when we remotely connect to the MySQL database on Ubuntu in Windows, we don't get an error.
Run the netstat command again:

Shell> NETSTAT-ANP | grep 3306
Output> TCP 0.0.0.0:3306 LISTEN

At this point, we found that the 3306 port is no longer just listening on the local, but also can listen to the connection request from the remote.

Problem solving for remote connection to 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.