Help with dB move

Started by pepf, October 23, 2019, 12:38:04 AM

Previous topic - Next topic

pepf

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.

Looking

You could use the old DB with the new install but what version was the old DB?

pepf

#2
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.

Looking

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?


Sir Osis of Liver

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.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Nate Silver

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.

pepf

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.




Illori

did you read the link i provided above? it tells you what you need to do.

pepf

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.

Sir Osis of Liver

Database credentials are in Settings.php in your forum root -



########## 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.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

pepf

#11
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.

Sir Osis of Liver

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.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Antechinus

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.

pepf

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.

Sir Osis of Liver

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?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

pepf

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...

pepf


Sir Osis of Liver

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.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

pepf

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?

Advertisement: