Remote connection MySQL Error 2003 solution

Source: Internet
Author: User


Problem Code Code

ERROR 2003 (HY000): Can ' t connect to MySQL server on ' 192.168.0.19 ' (111)
ERROR 2003 (HY000): Can ' t connect to MySQL server on ' 192.168.0.19 ' (111) The reason is the MySQL database default profile my.cnf (Linux) Bind-addre SS defaults to 127.0.0.1, so even if you create a remote access user, you can not use the mysql-h command to access, if the access will have problems, because at this time MySQL only accept localhost, So we need to shield the bind-address off.
MY.CNF is generally under/etc/mysql, if the locate MY.CNF lookup is not used, the MY.CNF profile before the modification is:
MY.CNF configuration file code before modification
#
# Instead of skip-networking The default is now to listen only
# localhost which are more compatible and are not less secure.
Bind-address = 127.0.0.1
#
# Instead of skip-networking The default is now to listen only
# localhost which are more compatible and are not less secure.
Bind-address = 127.0.0.1
All we need to do is block this bind-address code, and the Shield code is:
MY.CNF configuration file code after shielding
#
# Instead of skip-networking The default is now to listen only
# localhost which are more compatible and are not less secure.
#bind-address = 127.0.0.1
#
# Instead of skip-networking The default is now to listen only
# localhost which are more compatible and are not less secure.
#bind-address = 127.0.0.1
Now you can use the mysql-h command to do what you want, such as the login system:
Log in to the database code
Mysql-h 192.168.0.19-u Root-p

If it doesn't work out, it could be a fire-proof problem.


1.mysql Error 2003 (HY000): Can ' t connect to MySQL server on ' localhost '

Solution: Close the firewall, Anyang computer network, Linux command

[root@etl01 bin]# chkconfig--list | Grep-i iptables ====check Fire wall

Iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[Root@etl01 bin]#/sbin/service iptables stop ====stop fire wall

Flushing firewall rules: [OK]

Setting chains to Policy Accept:nat filter [OK]

Unloading iptables modules: [OK]

2. Error: 1130-host ... is not allowed to connect to this MYSQL server

Solution:

form of authorization

For example, the account is root and the password is root.

Use MySQL;

Access the MySQL database from any host using the root account

Grant all privileges in *.* to ' root ' @ '% ' identified by ' root ' with GRANT OPTION;

If you want to allow the user ZZ to connect to the MySQL server from IP for 192.168.1.3 host, and use 123456 as the password

Grant all privileges in *.* to ' root ' @ ' 192.168.1.3 ' identified by ' 123456 ' with GRANT OPTION;

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.