yabdab's avatar

yabdab liked a comment+100 XP

4mos ago

That SQLSTATE[HY000] [2002] Connection refused error usually means Laravel can’t reach your MySQL server not that the sessions table itself is broken. It’s common after updates or on shared hosts.

Try this:

In your .env, set DB_HOST=127.0.0.1 (not localhost) and recheck the username/password.

Run:

php artisan config:clear php artisan cache:clear

Some hosts use a different socket, like /tmp/mysql.sock, so you might need:

DB_SOCKET=/tmp/mysql.sock

Make sure your .env file is actually being loaded — some shared hosts ignore it.

If the issue persists, your MySQL instance might’ve gotten corrupted or disconnected. Running a quick repair using a tool like Stellar Repair for MySQL can help restore stability before reconnecting Laravel.