Details on remote connection to Mysql database of ERROR 2003 of HY000

  • 2020-05-19 06:05:54
  • OfStack

When we use the client and its remote connection to the server Mysql database, the following problems are prone to occur:
Problem code
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.19' (111)
ERROR HY000 (2003) : Can't connect to MySQL server on '192.168.0.19' (111) this is because bind-address in the Mysql database's default configuration file my.cnf (linux) is 127.0.0.1 by default, so even if you create a user that can be accessed by remote, you cannot access it using the mysql-h command. If you want to access Mysql, there will be a problem. Since Mysql only accepts localhost, you need to block bind-address.

my.cnf1 is usually found under /etc/mysql. If you do not use locate my.cnf, the configuration file of my.cnf before modification is:

Modify the previous my.cnf configuration file code
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
What we need to do is to mask this bind-address code, and the code after shielding is:

my.cnf configuration file code after masking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
Now you can use the mysql-h command to do what you want, such as log in to the system:

Login database code
mysql -h 192.168.0.19 -u root -p


Related articles: