MySQL cannot connect remotely to a solution

Source: Internet
Author: User

1. See if the/ETC/MYSQL/MY.CNF configuration file only allows local connections

Note configuration: #bind-address = 127.0.0.1, restart MySQL Server

2, Firewall (I use iptables) prohibit 3306 port access

Add the 3306 port to the/etc/sysconfig/iptables configuration file, and then restart the firewall by adding the following:

-A input-m state--state new-m tcp-p TCP--dport 3306 -j ACCEPT

3. mysql does not grant the appropriate permissions

Authorized user username use password to connect to MySQL Server from any host and allow access to all tables in all databases

*.* 'username  '@'%'password' with GRANT option;mysql >flush privileges;

Allows user username to connect to MySQL Server using password from IP- 192.168.1.9 hosts and allows access to all tables in all databases

*.* ' username '@'192.168.1.9'password ' with GRANT OPTION; MySQL>flush privileges;

Allow user username to connect to all tables under the DSP database of MySQL server using password from a host with IP 192.168.1.9

dsp.* 'username  '@'192.168.1.9'password' with  GRANT OPTION; MySQL>flush privileges;

4. Modify the host limit of the corresponding user username in the users table in the MySQL database

$mysql-H127.0.0.1 -P3306 -u root–pmysql> UseMysql;mysql>Update User SetHost= '%' where User= 'username'; MySQL>SelectHostUser from User;

OK,:)

MySQL cannot connect remotely to a 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.