MySQL cannot be accessed remotely under Linux

Source: Internet
Author: User

A MySQL database was recently installed on Linux, but the remote connection to MySQL always reported Erro 2003:can ' t connect to MySQL server on ' 211.87.***.*** ' (111), It took several hours yesterday to find the solution, as follows:

1.sudo gedit/etc/mysql.my.cnf

Find Bind-address =127.0.0.1

Modified to Bind-address =0.0.0.0

2.sudo/etc/init.d/mysql restart

In this case, if you try a remote connection again, the error 1130 (HY000) is reported: Host ' 211.87.***.*** ' is not allowed to connect to this MySQL server prompt, and the database cannot be connected remotely.

On MySQL host, follow the instructions below

Mysql-u Root-ppassword//Enter the MySQL console

Mysql>use MySQL;

Mysql>update User Set host = '% ' where user = ' root '; This command can be skipped when executing an error

Mysql>flush privileges;

Mysql>select host, user from user; Check that '% ' is inserted into the database

Mysql>quit

3. Other

Mysqladmin-u root Password 123//Change Password
Add skip-grant-tables//Skip MySQL access control in/ETY/MY.CNF

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.