Advertisement:

Author Topic: Help with dB move  (Read 1640 times)

Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Help with dB move
« on: October 23, 2019, 12:38:04 AM »
Hello,

Looking for some advice regarding dB move to new installation. Not sure about this as I'm doing it for the first time myself.
After installing the same version of SMF anew I would like to use the old dB, settings and attachments.

I assume just moving the old attachments folder to the new installation will do, but what about the dB.

Currently the old dB and the one created during the new installation are both present. What is the easiest way to have the new SMF recognize the old dB and settings?
Does moving the old Settings.php or just renaming the dB do this, or do I need to import the old dB into the new one?

TIA for any help.

Offline Looking

  • SMF Hero
  • ******
  • Posts: 2,381
  • SMF Customization
    • jeanborde on Facebook
    • SMF Custom Themes & Custom Coding
Re: Help with dB move
« Reply #1 on: October 23, 2019, 05:01:27 AM »
You could use the old DB with the new install but what version was the old DB?

Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Re: Help with dB move
« Reply #2 on: October 23, 2019, 10:00:20 AM »
Both are 2.0.15, the same version.
What I do not understand is how to get the new SMF installation to connect to the existing dB instead of the new dB that is created during the installation.
The procedure I used may be wrong.
« Last Edit: October 23, 2019, 10:25:29 AM by pepf »

Offline Looking

  • SMF Hero
  • ******
  • Posts: 2,381
  • SMF Customization
    • jeanborde on Facebook
    • SMF Custom Themes & Custom Coding
Re: Help with dB move
« Reply #3 on: October 23, 2019, 10:03:13 AM »
Use this: repair settings and in the DB section put the credentials of the old DB. Understanding where it goes and what it does: What is repair_settings.php?

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,584

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,469
Re: Help with dB move
« Reply #5 on: October 23, 2019, 12:17:13 PM »
You can drop tables in the new db, import old db into new.  Or do as suggested and fix settings to connect to old db.

Offline Nate Silver

  • Semi-Newbie
  • *
  • Posts: 14
Re: Help with dB move
« Reply #6 on: October 23, 2019, 04:21:14 PM »
In case the new installation does not have the same URL the previous forum had, you can use a text editor (I use notepad++) to search every time the old url shows up and replace it with the new one. You should to the same thing to the "/home/USER/public_html/FORUM/" bits, then import that dB to a blank dB and change the settings file to reflect the new dB.

It might be convoluted and there might be ways with less steps, but it works for me and it's quicker than it seems.

Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Re: Help with dB move
« Reply #7 on: October 23, 2019, 06:55:50 PM »
Thank you all for the help. Something to work with, I will try your suggestions.
I have some more questions.

Tried some things but not yet the Settings file suggestion, will do that next.

I assume the different naming of the old dB (moved from another host) does not affect this negatively?
I actually imported the old dB into the new one, but still the new SMF showed no change, I assume that is because I did not use the Settings file. I will do that next.

Is there anything else I can move to restore the old board settings and appearance of the forum?

Thanks again for your generous help.




Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,584
Re: Help with dB move
« Reply #8 on: October 23, 2019, 07:03:00 PM »
did you read the link i provided above? it tells you what you need to do.

Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Re: Help with dB move
« Reply #9 on: October 23, 2019, 07:59:16 PM »
Yes. I cannot count on help from my host. (Their support was quite nasty telling me that SMF was old and not updated (it is the updated version 2.0.15). They insisted that some code had been injected and quarantined the whole site, even completely unrelated files. The only scripts active were SMF.) But I have not gotten to that yet.

I am redoing now the whole process, deleted and reinstalled SMF,,,
I have a problem that I am trying to resolve right now. I just reinstalled and tried to import the old dB again, but it has no 'user' attached. Somehow this was removed in the process. I assume I will have to give it privileges in order to work? However, phpmyadmin does not have a tab for assigning users or privileges to a dB. Trying to find out how to do that at present.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,469
Re: Help with dB move
« Reply #10 on: October 23, 2019, 09:23:59 PM »
Database credentials are in Settings.php in your forum root -

Code: [Select]

########## Database Info ##########
$db_type = 'mysql';
$db_server = 'localhost';
$db_name = 'thekrash_smf20';
$db_user = 'thekrash_smf20';
$db_passwd = 'xxxxxxxxxxxx';
$ssi_db_user = '';
$ssi_db_passwd = '';
$db_prefix = 'smf_';
$db_persist = 0;
$db_error_send = 1;


You can update the settings by editing the file manually, or use repair_settings.php.  $db_server is usually localhost, but not always.  $db_name, $db_user, $db_passwd are required to connect to the database.  If you don't know what they are, look in the mysql database section of your host cpanel, that's where users are created and assigned.  You'll have to reset the password if you don't have it.


Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Re: Help with dB move
« Reply #11 on: October 23, 2019, 09:32:59 PM »
Thank you. I resolved the problem with no user privileges, now both databases have the same user and privileges, but after I tried to reimport the new dB is still the same in size. Will first have to sort this out and then go to to the next step.
The import was given as completed by phpMyAdmin, but in cPanel the size of both remained the same. I wonder if there is another way to see whether the process was actually completed.
« Last Edit: October 23, 2019, 09:47:58 PM by pepf »

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,469
Re: Help with dB move
« Reply #12 on: October 23, 2019, 09:59:36 PM »
If I understand correctly, you have a new scratch db created by the 2.0.15 install package, which is connected to the new install, and a backup of your production db.  Drop all tables in the new db (with phpmyadmin), it will have 0 tables.  Then import the production backup.  IIRC, there are 63 tables in a new 2.0 install (first is smf_admin_info_files, last is smf_topics ), so you should see at least that many after import completes.  Mods can add additional tables.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,844
  • Master of BBC Abuse
Re: Help with dB move
« Reply #13 on: October 23, 2019, 10:15:06 PM »
Just be aware that phpMyAdmin tends to have trouble importing large databases. If it's 20 megabytes or less, it should be fine. If it's much larger than that, it may be necessary to break it into manageable chunks.

Alternatively, since you say you have cPanel, it should be possible to restore via cPanel's database tools.

Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Re: Help with dB move
« Reply #14 on: October 23, 2019, 11:29:05 PM »
Thank you Sir Osis. It is really complex for someone who never did that, but the dropping of the tables went fine, as did the following importing into the newDB. I can see the tables in phpMyAdmin, but strangely the size has not changed at all if viewed in cPanel. New and old should now approximately the same.

To Antechinus, I can see how to restore a backup in cPanel, but nothing about importing an old one into a new dB.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,469
Re: Help with dB move
« Reply #15 on: October 23, 2019, 11:35:40 PM »
How large is the db?  If the total size is correct in phpmyadmin, it's probably ok.  Is the new install connecting to the db?  Link?

Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Re: Help with dB move
« Reply #16 on: October 24, 2019, 12:01:31 AM »
Just did the repair_settings step. It did make both dBs the same size,
But there is now a blank page with the message Table 'xxxx.smfph_settings' doesn't exist.
xxxx is the actual dB name, not sure what 'smfph_settings' is...

Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Re: Help with dB move
« Reply #17 on: October 24, 2019, 12:04:08 AM »
The dB size is 25.99 mb.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,469
Re: Help with dB move
« Reply #18 on: October 24, 2019, 12:08:15 AM »
smfph_ is the table prefix, default value is smf_.  $db_prefix in Settings.php must agree with prefix you see in phpmyadmin in front of all table names.


Offline pepf

  • Semi-Newbie
  • *
  • Posts: 49
Re: Help with dB move
« Reply #19 on: October 24, 2019, 12:40:35 AM »
Both old and new dB have always started with "east...", all database names start with user/account name_dB prefix. Not sure why the smfph was added during the SMF installation. So should I uninstall and reinstall again to correct this?