If you are using Laravel Herd Pro with a MySQL database, you may run into the “Error establishing a database connection” error.
To fix this, change your database host settings from define('DB_HOST', 'localhost');
to define('DB_HOST', '127.0.0.1');
and that should do the trick.
This can also fix errors from other software that attempts to connect using a socket (e.g., “Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’”).