SQLSTATE[HY000] [2002] Operation timed out MySQL

When you have this problem from MySQL with a fresh installation, you have to comment the bind address line in ‘/etc/mysql/mysql.conf.d/mysqld.cnf’:

#bind-address=127.0.0.1

Don’t forget to restart MySQL service

sudo service mysql restart

If you are using the UFW service, add this rule to your firewall:

sudo ufw allow from <IP_FROM_YOU_CONNECT> to any port 3306

Font: https://laracasts.com/discuss/channels/laravel/sqlstatehy000-2002-connection-timed-out

Leave a Reply