How to solve the remote connection problem of ubuntu MySQL

Source: Internet
Author: User

When opennebula 3.8 is configured today, when one start is started, an error indicating that the database cannot be connected is reported. However, you can log on by entering mysql-uroot-P in shell, therefore, the problem should be that MySQL does not allow the root user to log on remotely. Therefore, run the following command:


  1. Grant all privileges on *. * to root @ "%" identified
    By 'Password' with grant option;

After I restarted MySQL, I found that I still couldn't connect to it. So I thought whether the firewall (UFW) or iptables disabled the port 3306. Through service iptables stop and UFW status, check that it is not a firewall or iptables problem, and through netstat, you can see that port 3306 is in the listening status.


After excluding the above factors, I Google again and found that the MySQL configuration file my. in CNF, use the following modification. After MySQL is restarted, it is successfully remotely logged on and opennebula is connected to the MySQL database.


  1. Sudo Vim/etc/MySQL/My. CNF
  2. // Locate the following content and comment out
  3. Bind-address = 127.0.0.1

Comment out bind-address = 127.0.0.1 and restart MySQL! If you do not comment it out, you can see through netstat that port 306 is only in the IP address
Listen on 127.0.0.1, so access from other IP addresses is denied.

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.