Troubleshoot MySQL cannot connect remotely

Source: Internet
Author: User
Tags bind mysql connect mysql command line

A remote connection to the MySQL database prompts the following message: "MySQL connect error–1130:host ' 202.43.**.** ' is not allowed to connect to this MySQL server"

Originally in the Create MySQL account is, limited Connection account remote login. That is, other than the current MySQL installation server, the other IP (host) is not allowed to access, although your username and password is correct.

Know the cause of the problem, the following to solve the problem.

First you need to log on to the MySQL installation host and then go to MySQL:

Mysql/usr/local/mysql/bin Mysql-u Root-p

Enter

Root is the highest authorized user name for MySQL, you will be prompted to enter the password, correct input password, enter the MySQL.

Then enter the following command:

Grant all on database name. * to ' Database account name ' @ '% ' identified by ' password ' with GRANT option;
Enter
Flush privileges;

Enter

Note: The above single quotation marks cannot be saved, the database name. * Indicates that all tables under the database to be opened, if all the databases of the connection are open, can be replaced with *.*.
The ' Database account name ' @ '% ' here represents the account to be opened, and the hundred-semicolon indicates that access is allowed on any host.
If both of these steps show "Query OK, 0 rows Affected (0.00 sec)", then the command has been successfully executed and you can now remotely connect to your MySQL database.

In addition, it is possible that your MySQL installation is bound by default fixed IP address: bind-address:127.0.0.1. The specific action is: to/ETC/MYSQL/MY.CNF (note: This is the Linux system) file, find bind-address this line, annotate it, and restart MySQL, you can remotely access.

Add: Use Tools to change tables


1. Change Table method.

Please use MySQL management tools, such as: SQLyog Enterprise

Your account may not be allowed to log in remotely, only in localhost. This time, as long as the computer in localhost using MySQL management tools login MySQL, change the "MySQL" Database in the "User" table in the "host" item, from "localhost" renamed "%"


2. Authorization law.

A: You want to MySQL account myuser use password mypassword from any host to connect to the MySQL server, then the MySQL command line to enter:
Grant all privileges in *.* to ' myuser ' @ '% ' identified by ' MyPassword ' with GRANT OPTION;

If the above command has not worked, then use the following command, must be successful!

If you want to allow the MySQL account myuser to connect to the MySQL server from the IP-192.168.1.3 host and use MyPassword as the password, enter at the MySQL command line:
Grant all privileges in *.* to ' myuser ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION;

If you change the table plus permissions, we can try the following methods

Edit My.ini

Add or modify the following two lines under the [mysqld] node
skip-name-resolve #忽略主机名的方式访问
Lower_case_table_names=1 #忽略数据库表名大小写
Modified, Restart MySQL.

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.