Solve the problem that MySQL can't connect to database remotely under Ubuntu

Source: Internet
Author: User
Tags bind connect mysql query access firewall

Ubuntu10.04 on the back of the MySQL, executed the
root@ubuntu:~ #sudo apt-get Install MySQL
After installing Mysql-server

Start MySQL
Root@ubuntu:~#/etc/init.d/mysql start

Local connections can be entered into the database.
root@ubuntu:~ #mysql-uroot-p

Remote access permissions are set:
Mysql> grant all privileges in *.* to admin@ '% ' identified by ' 123456′;
Query OK, 0 rows affected (0.04 sec)

Mysql> Use Information_schema
Mysql> select * from User_privileges;
Query to have the following result: ' admin ' @ '% ', indicating that MySQL has authorized remote connection.

Access to the Ubuntu database under Windows is not connected, but the Apache installed on Ubuntu can be accessed.
You cannot access it after adding port 3306 with Iptalbes.
root@ubuntu:~# iptables-a input-p tcp–dport 3306-j ACCEPT

View MySQL network connection on Ubuntu:
root@ubuntu:~# Netstat-an grep 3306
TCP 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
The local port is also listening.

root@ubuntu:~# UFW Status
Firewall not loaded
Local Firewall not open

Later on the Internet to find a solution:
See/etc/mysql/my.cnf found bind-address only found configured is 127.0.0.1 (bind-address=127.0.0.1), directly to bind-address=192.168.0.xxx (native IP) And then look at the 3306 port open, OK, you can connect properly




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.