Advertisement:

Author Topic: Moving to a new host : Can't connect to the database  (Read 386 times)

Offline 420SA

  • Semi-Newbie
  • *
  • Posts: 61
Moving to a new host : Can't connect to the database
« on: January 11, 2018, 03:28:40 AM »
Hi guys perhaps you could please assist me

I'm in the process of moving to another hosting provider. I have copied over all the files and database. Set all privileges etc but I can't seem to connect to the database when I run repair settings.

It tells me "Some settings are not being shown because the database connection information is incorrect. Check your database login details, table prefix and that the database actually contains your SMF tables." It also says "SMF N/A Settings Repair Tool" at the top so its not able to pick up what forum version it is.

I've doubled checked everything many times and changed the password several times. Nothing helps.

What could be causing this?

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,542
  • Gender: Male
  • the "mods and tweaks" junkie
    • dopetalk
Re: Moving to a new host : Can't connect to the database
« Reply #1 on: January 11, 2018, 03:54:40 AM »
i'm in Australia, the other timezone and not part of SM support (I think they sleep every now and then  ::)) but will try to help. You may need to modify Settings.php in the web root directory.

The password to your database may have changed so try to edit that file accordingly - it is the variable $db_password.

there are other variables there too ($db_user etc.) and they all have to match your new environment.

those settings are outside the scope of repair_settings.php and have to be configured first.

you may need to discuss this with your host, your admin or yourself  :P.

it's usually a very common problem that i have had myself.
« Last Edit: January 11, 2018, 04:12:26 AM by aegersz »
The configuration of my Linux VPS (SMF 2.0 with 145 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline 420SA

  • Semi-Newbie
  • *
  • Posts: 61
Re: Moving to a new host : Can't connect to the database
« Reply #2 on: January 11, 2018, 04:12:04 AM »
i'm in Australia and not part of SM support but will try to help. You may need to modify Settings.php in the web root directory.

The password to your database may have changed so try to edit that file accordingly - it is the variable $db_password.

there are other variables there too ($db_user etc.) and they all have to match your new environment.

those settings are outside the scope of repair_settings.php and have to be configured first.

you may need to discuss this with your host, your admin or yourself  :P.

it's usually a very common problem that i have myself.

Thanks for your input but unfortunately I've checked that. Everything in the settings.php file reflects the details of the new environment(db name, user and password) and yet it doesn't connect to the DB. If I try to access the forum I just get a blank white page.

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,542
  • Gender: Male
  • the "mods and tweaks" junkie
    • dopetalk
Re: Moving to a new host : Can't connect to the database
« Reply #3 on: January 11, 2018, 04:19:24 AM »
can you confirm that the database is accessable and available somehow ?

do you have access to phpmyadmin, for example ?

$db_server, $db_prefix too ?

The configuration of my Linux VPS (SMF 2.0 with 145 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline 420SA

  • Semi-Newbie
  • *
  • Posts: 61
Re: Moving to a new host : Can't connect to the database
« Reply #4 on: January 11, 2018, 04:20:36 AM »
Could it be URL related? The domain is still pointing to the old server but I've edited my hosts file on my PC in order to access the website on the new server

Offline 420SA

  • Semi-Newbie
  • *
  • Posts: 61
Re: Moving to a new host : Can't connect to the database
« Reply #5 on: January 11, 2018, 04:23:07 AM »
can you confirm that the database is accessable and available somehow ?

do you have access to phpmyadmin, for example ?

$db_server, $db_prefix too ?

Yes I have access to phpmyadmin. The database is there under the correct name with all the required tables. The database is also assigned to a user... is there a possibility that the database may still be inaccessible?

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,542
  • Gender: Male
  • the "mods and tweaks" junkie
    • dopetalk
Re: Moving to a new host : Can't connect to the database
« Reply #6 on: January 11, 2018, 04:28:33 AM »
no. if you see it in phpmyadmin and can display the tables then it is considered available ... run the browse facility to check for populated table data if in doubt.

did you check $db_prefix ? (table prefix with "_" [underscore])

is it on the local host or via a port number ?
The configuration of my Linux VPS (SMF 2.0 with 145 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline 420SA

  • Semi-Newbie
  • *
  • Posts: 61
Re: Moving to a new host : Can't connect to the database
« Reply #7 on: January 11, 2018, 04:33:00 AM »
no. if you see it in phpmyadmin and can display the tables then it is considered available ... run the browse facility to check for populated table data if in doubt.

did you check $db_prefix ? (table prefix with "_" [underscore])

Yes

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Moving to a new host : Can't connect to the database
« Reply #8 on: January 11, 2018, 04:34:28 AM »
If the screen is white, that doesn't reflect a could not connect problem. Check your host error log.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline 420SA

  • Semi-Newbie
  • *
  • Posts: 61
Re: Moving to a new host : Can't connect to the database
« Reply #9 on: January 11, 2018, 04:39:52 AM »
If the screen is white, that doesn't reflect a could not connect problem. Check your host error log.

I checked under Metrics => Errors in the Cpanel and no errors show. Is there some other error logs I should be checking?

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,542
  • Gender: Male
  • the "mods and tweaks" junkie
    • dopetalk
Re: Moving to a new host : Can't connect to the database
« Reply #10 on: January 11, 2018, 05:21:46 AM »
Arantor wants you to look for PHP errors as they are the most common cause of white screens. They could be the webserver logs (Apache for example) or messages (a common Linux log). Your host will know where to find PHP errors.

IME, database connectivity errors also result in whitescreens too so you have to do some digging, even if by proxy c/o your host.
The configuration of my Linux VPS (SMF 2.0 with 145 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline 420SA

  • Semi-Newbie
  • *
  • Posts: 61
Re: Moving to a new host : Can't connect to the database
« Reply #11 on: January 11, 2018, 05:30:40 AM »
I did the transfer to another host I'm using for another site and the transfer was a success. Something must have gone wrong with the transfer process

Thanks for your help though guys I'm sure I'll find the fix

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,542
  • Gender: Male
  • the "mods and tweaks" junkie
    • dopetalk
Re: Moving to a new host : Can't connect to the database
« Reply #12 on: January 11, 2018, 05:37:06 AM »
good job to try again because i was out of ideas.

i don't know how Arantor and his team stay sane with all the different issues, let alone the ones that are caused by inexplicable and unpredictable errors.

much luck with your migration

Einstein said that one sign of madness was doing the same thing and expecting a different outcome but then he didn't have silly computers back then !
The configuration of my Linux VPS (SMF 2.0 with 145 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here