Troubleshooting: Error 111 - Unable to connect to MySQL server
P粉236743689
P粉236743689 2023-08-02 20:16:12
0
2
685
<p>I installed the MySQL server on a Linux host with the IP address 192.168.1.100, but when I try to connect to this IP, I always get an error (111). But using localhost and 127.0.0.1 is ok. </p> <pre>beer@beer-laptop# ifconfig | grep "inet addr" inet addr:127.0.0.1 Mask:255.0.0.0 inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 beer@beer-laptop# mysql -ubeer -pbeer -h192.168.1.100 ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.100' (111) beer@beer-laptop# mysql -ubeer -pbeer -hlocalhost Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 160 Server version: 5.1.31-1ubuntu2 (Ubuntu) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> beer@beer-laptop# mysql -ubeer -pbeer -h127.0.0.1 Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 161 Server version: 5.1.31-1ubuntu2 (Ubuntu) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> </pre> <p>Error 111 also occurs when connecting from another machine. </p> <pre>another@another-laptop# mysql -ubeer -pbeer -h192.168.1.100 ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.100' (111) </pre> <p>In this case, what is the difference between using localhost or 127.0.0.1 versus using 192.168.1.100? I don't know how to connect to this database from another machine. <br /><br />Please help, thank you. </p><p><br /></p>
P粉236743689
P粉236743689

reply all(2)
P粉936509635

111 means connection refused, which means your mysqld is only listening on the localhost interface.

To make modifications, you can view the bind-address value of the mysqld section in the my.cnf file.

P粉471207302

This probably means that your MySQL server is only listening on the localhost interface.

If you have a line similar to:


bind-address = 127.0.0.1

In your my.cnf configuration file, you should comment them out (add # at the beginning of the line) and then restart MySQL.

sudo service mysql restart

Of course, to perform this operation, you must be the administrator of the server.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!