Basically, the error “Can’t connect to mysql error 111” will show up whenever the user makes use of public IP address on a Linux computer. But it will get connected when the user makes use of the localhost and 127.0.0.1.
Below mentioned are some procedures to check the status ofMysql before we fix the error:
If the command doesn’t work, then we can try the below command.
sudo service mysql start using the below command, we can check the hostname:
If there is no error or issues with the above commands, we shall proceed with the following steps.
Initially, use this command bind-address = 127.0.0.1 in my.cnf configuration file, by adding # on the starting line. And restart Mysql using $ sudo service mysql restart Command on which we should have an access to the root server.
Next, we need to login as the root server and then use the below commands to verify user privileges.
Lastly, we have to connect it again with the help of mysql -ubob -pbob -h195.168.1.100 to verify it’s working.
Below mentioned are some procedures to check the status ofMysql before we fix the error:
- First of all, we need to make sure that the MYSQL is working properly using the below command:
Code:
sudopswwaux | grep -isql
sudo service mysql start using the below command, we can check the hostname:
Code:
sudonetstat -plutn | grep -isql
Initially, use this command bind-address = 127.0.0.1 in my.cnf configuration file, by adding # on the starting line. And restart Mysql using $ sudo service mysql restart Command on which we should have an access to the root server.
Next, we need to login as the root server and then use the below commands to verify user privileges.
Code:
CREATE USER ‘root’@’195.168.1.100’ IDENTIFIED BY ‘***’;
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’195.168.1.100’ IDENTIFIED BY
‘***’ WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR
0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;