Jump to content

Error: Exception: SQLSTATE[HY000] [2002] Connection refused (in /wire/core/WireDatabasePDO.php line 467)


wishbone
 Share

Recommended Posts

I copied an install from local to remote. I just copied all the files, and of course imported the database.

Checked the database connection details in config.php ten times over.

Can't connect to the database.

Link to comment
Share on other sites

That is a classic error message that I get all the time: The Database connection cant be established. Mostly because I forgot one of the things:

- Do you have a variable in your config to switch between two development environments (local/live)? So that you are still trying to use your local database settings on your live site?
- Do you already have a working PW installation on the remote server? Try checking the config values against the config that refuses the connection
 

  • Like 2
Link to comment
Share on other sites

thank you!! when I understood it's not a matter of the pw-install, I searched again - and I don't believe how easy it was: the database name was casus sensitive. I had the prefix in capitals: DB...

how many hours!

learnt also that it's ok to just copy all the files from local to remote without new install

thx again

  • Like 1
Link to comment
Share on other sites

Most of the time its the smallest things that cause the biggest problems when going "live" with a site ?

9 minutes ago, wishbone said:

thank you!! when I understood it's not a matter of the pw-install, I searched again - and I don't believe how easy it was: the database name was casus sensitive. I had the prefix in capitals: DB...

how many hours!

learnt also that it's ok to just copy all the files from local to remote without new install

thx again

That is the usual way I do it (and I think most of developers do):

1. Export your local database
2. Create a new (empty) database on your live server and import the database there
3. Upload all project data from your local directory to the live server via FTP
4. Adjust the config files for the new database connection
5. Testing with debug mode enabled

  • Like 1
Link to comment
Share on other sites

 

For step 4 you could also create copy of your config.php file called config-dev.php to have different config/database settings on your local site. And if your using Git you can easily ignore the config-dev file so local settings it won't end op on your repo. 

1 hour ago, Stefanowitsch said:

That is the usual way I do it (and I think most of developers do):

1. Export your local database
2. Create a new (empty) database on your live server and import the database there
3. Upload all project data from your local directory to the live server via FTP
4. Adjust the config files for the new database connection
5. Testing with debug mode enabled

 

Link to comment
Share on other sites

On 5/16/2022 at 3:06 PM, Stefanowitsch said:

That is the usual way I do it (and I think most of developers do):

people often suggest to first do a new install and then copy the site into it.

Or even to use "one of the" migration modules.

But just copying everything works! so I think it's the easiest way.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...