Laravel SQLSTATE[HY000] [2002] Connection refused within macOs

If you are in mac environment and using Laravel and mysql and encounter such an error:

SQLSTATE[HY000] [2002] Connection refused

The solution would be:

Just open the mysql config file at /usr/local/etc/my.cnf with your editor and comment out the following line:

!includedir /usr/local/etc/my.cnf.d

It should be the same as :

# !includedir /usr/local/etc/my.cnf.d

Written by

Web geek, Self-taught full-stack web developer, Learning Python, Laravel, Vuejs, UX/UI design, Nuclear Physicist PhD

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store