Can you connect to the database from the command line?
mysql -u root -p
Replace root with your mysql username if you have another one.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I just upgraded my PHP version from 7.2 to 7.4 and now whenever I try to run a query, I get this error. Here are my relevant .env credentials:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
I've tried as many have suggested and tried changing the DB_HOST to 127.0.0.1 and I get this error instead:
SQLSTATE[HY000] [2002] Connection refused
This is the first time I've ever performed a PHP upgrade. Is it normal to have issues like this? Particularly with Laravel?
Thanks
Please or to participate in this conversation.