Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dionarap's avatar

Error connecting to database after server change

I have recently changed server and uploaded my database to the server, for the live website i made no changes to my env and everything works the same. But in my php storm development i have had to change the ip(db host) and despite the username and password being the same as the live website i am getting an error suggesting i can't access.

SQLSTATE[HY000] [1045] Access denied for user 'connect'@'xxxxxx' (using password: YES)

I have cleared config and cache and tried launching php artisan again but get the same issue. i have even brought in the env from the server(live website) and changed the DB Host to match the IP of the server but then the error occurs. Does anyone know how i fix this error, could it be an issue with the fact the database was imported from another server?

0 likes
5 replies
Tray2's avatar

Normally the host for the database is localhost so check your .env file that DB_HOST=127.0.0.1 is set

dionarap's avatar

Yep that won't work, the website is on the server so and the database is connected fine. This issue is with my development in phpstorm to which im trying to connect to the database host and thats where the issue comes.

Snapey's avatar

Your user account on the database server has to be enabled for remote access

dionarap's avatar

ITs the same account im using for local access, how do i change it on cpanel to allow remote access aswell?

Please or to participate in this conversation.