News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Database Backup

Started by DFarish, November 12, 2009, 05:14:39 PM

Previous topic - Next topic

DFarish

I noticed when I upgraded that the Databases were backed up. Is it possable to restore the forum to what I had before i started having all the problems? If so where is the backup file located?

Thank You for all the help.

Doug
Thanks,

Doug

babjusi

Quote from: DFarish on November 12, 2009, 05:14:39 PM
I noticed when I upgraded that the Databases were backed up. Is it possable to restore the forum to what I had before i started having all the problems? If so where is the backup file located?

Thank You for all the help.

Doug

Do you mean the backup made by the upgrader? if so, check your db for tables starting with the backup_ prefix. Those are the tables you need.

DFarish

Okay. Is there a way for the forum software to restore them? If not how would I do that? I'm real new to PHP and MySQL.

Doug
Thanks,

Doug

babjusi

Quote from: DFarish on November 12, 2009, 05:26:45 PM
Okay. Is there a way for the forum software to restore them? If not how would I do that? I'm real new to PHP and MySQL.

Doug

From which version did you upgrade? All you have to do is upload the files of the version you had before you did the upgrade, then open the Settings.php file and change the db prefix in there to the backup_ whatever name the upgrader gave the tables when it backed them up and you should be all set.

Norv

First, please make sure you restore the same version of the SMF files as your database is. For that, the large upgrade package to that SMF version is the best choice. Please upload all files in it over those of the version you want to get rid of, if you didn't already.

Option 1:
Perhaps the quickest way to do it is to set your forum to use them, instead of using the current ones. (though it will be useful to keep it in mind for the future, that your tables prefix will become "backup_[previous_prefix]" where previous_prefix is the prefix your tables have now).
Then, upload the file repair_settings.php ( What is repair_settings.php? ) to your forum directory, then run it from the browser. You will see a page with various settings, including database prefix: change it to backup_[your_previous_prefix] (for instance, if the previous prefix was "smf_" then change it to "backup_smf_".

Option 2:
Perhaps not the quickest, but nicest on the long run: in phpMyAdmin, select your database, and then the "Export" tab. Select the tables starting with backup_ there, and save them all to a file. (with structure too, and data). Then, try opening the resulted sql file in a text editor (a lightweight editor like Notepad++ would be good if you're on windows), and find and replace all occurrences of "backup_" in the name of tables with an empty text.
Save it, then choose to "import" it into another database (that you may need to create). Then, use the same repair_settings.php to correct the name of the database (this time, as it's the database which will be different), or, rename the old database as something else "backup_database" for example, and the new one like the old one (then you don't need to run repair_settings anymore).

ETA: babjusi was much quicker :)
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

DFarish

I think that I will do the latter. Running repair_settings.php is what got me in this mess. It changed something that will not let the board talk to the server even though the settings are correct. I may see if I can get my hosting service to move the files for me so I wont mess it up again.

Thank You. Can I leave this open until I see if this is going to work?

Doug
Thanks,

Doug

Norv

Quote from: DFarish on November 12, 2009, 06:03:29 PM
I think that I will do the latter. Running repair_settings.php is what got me in this mess. It changed something that will not let the board talk to the server even though the settings are correct.
This sounds really strange, repair_settings doesn't change anything else but what you see there on its page. If what it's there on the page is correct, then the problem is elsewhere. Was your host's server working correctly at the time?

Of course you can leave topics open for as long as necessary since they're unsolved.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

DFarish

Yes. Right after I ran the php file is when the error in connecting to the server started. If I remember right the repair_settings.php told me on the server name was localhost. That was not right. I found that out in the settings.php file. I made the changes as to what the back up said. and checked with my hosting company and there database techs look over all the settings and said that they all okay. everything matched right down to the last part of the syntax.

This just floored me. I was on the phone at 3:30am for about 45 minutes. Up all night trying to get this resolved.

Anyway if I can leave this open until this is resolved that would be great.

Doug
Thanks,

Doug

Norv

Quote from: DFarish on November 12, 2009, 06:32:27 PM
Yes. Right after I ran the php file is when the error in connecting to the server started. If I remember right the repair_settings.php told me on the server name was localhost. That was not right.
I'm afraid there's a misunderstanding here.
repair_settings does not tell you what to set, it allows you to set the values you know to be appropriate for your system, while it recommends the most likely values. Your host's database server name should be known to you, it is usually "localhost", but if your host's database server name is different, then you should enter your host's value. There is no way to know automatically what you host has decided that your database server is. "localhost" is only a fallback choice, a default choice if your host doesn't use another.
Similar for all the other settings. For example, usually the "attachments" directory is in SMF_folder/attachments, and that is the default value too, of a SMF installation. But if you changed it or want to change it, then you should enter the other value you wish.
What repair_settings does, is to make sure it sets all these values you want and know to be appropriate for your installation, in all the right places in SMF where they should be saved. In other words, it's a convenience tool (it's provided to allow you to change easily those values, instead of searching directly each place in SMF where they are saved), not a tool that can tell you what to do.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

DFarish

#9
Okay I understand that. In your opinion will moving the old database from the old forum to the new restore what I had? The new board is working fine. All the settings are correct and SMF is connecting to the server. I have looked at the old database and all my member records and all the rest are there. I have not made any changes to any thing at all.

Thanks,

Doug
Thanks,

Doug

DFarish

Got the Forum back. Yea!!!!!!!! It was a password issue on the server. All fixed and did not loose anything.

Thanks for all the great help,

Doug
Thanks,

Doug

Norv

Cheers! :)

All that's needed is to have the same database version as the forum files (i.e., if you restored a database from SMF 2.0 RC1.2, then it works with files from SMF 2.0 RC1.2 package, or if you upgraded to RC2, then the RC2 files and a database upgraded to RC2 are needed to work together).
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

CerebralJam

Hi there, I have followed this thread with interest.  I did upgrade successfully to RC2 but as 75% of my mods do not have upgrades as yet I decided I needed to go back... I am just struggling with the database connection, even using the repair tool.  I am just probably not naming it correctly.

I have changed the settings to "backup_smf"
and the database created backup_smf

Can you tell me where I might be going wrong?  I just don't follow how you rename the database bit - when you say prefix, do you mean the original name of the database followed by backup_smf without _in front or what?  Help! :D

babjusi

Quote from: CerebralJam on November 14, 2009, 04:44:05 PM
Hi there, I have followed this thread with interest.  I did upgrade successfully to RC2 but as 75% of my mods do not have upgrades as yet I decided I needed to go back... I am just struggling with the database connection, even using the repair tool.  I am just probably not naming it correctly.

I have changed the settings to "backup_smf"
and the database created backup_smf

Can you tell me where I might be going wrong?  I just don't follow how you rename the database bit - when you say prefix, do you mean the original name of the database followed by backup_smf without _in front or what?  Help! :D

Did you choose for the upgrader to backup the tables prior to the backup? Did you do any backup at all btw, prior to the upgrade?

Norv

In case you used the backup feature of the upgrade script (during the upgrade, the checkbox to "backup your tables"), then you should have many different tables in your database now, named "backup_" + [your_normal_smf_prefix] + [tablename]. Meaning the new prefix (when you decide to use these) will be "backup_" + [your_normal_smf_prefix] .

Quote from: CerebralJam on November 14, 2009, 04:44:05 PM
I have changed the settings to "backup_smf"
Can you please tell, what setting ? The prefix should be "backup_smf_", if you previous prefix was "smf_".
Quote from: CerebralJam on November 14, 2009, 04:44:05 PM
and the database created backup_smf
Perhaps this is the misunderstanding: the database is the same, the backing up feature of the upgrader does not create another database. It duplicates all tables of your original database, into the same database, naming each copied table "backup_"+former name. So your database name should still be the previous name.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

CerebralJam

Quote from: babjusi on November 14, 2009, 04:49:38 PM
Quote from: CerebralJam on November 14, 2009, 04:44:05 PM
Hi there, I have followed this thread with interest.  I did upgrade successfully to RC2 but as 75% of my mods do not have upgrades as yet I decided I needed to go back... I am just struggling with the database connection, even using the repair tool.  I am just probably not naming it correctly.

I have changed the settings to "backup_smf"
and the database created backup_smf

Can you tell me where I might be going wrong?  I just don't follow how you rename the database bit - when you say prefix, do you mean the original name of the database followed by backup_smf without _in front or what?  Help! :D

Did you choose for the upgrader to backup the tables prior to the backup? Did you do any backup at all btw, prior to the upgrade?

I chose to backup the database before upgrading to RC2

I have tables in my phpadmin files called backup_smf_

babjusi

Quote from: CerebralJam on November 14, 2009, 04:53:33 PM
Quote from: babjusi on November 14, 2009, 04:49:38 PM
Quote from: CerebralJam on November 14, 2009, 04:44:05 PM
Hi there, I have followed this thread with interest.  I did upgrade successfully to RC2 but as 75% of my mods do not have upgrades as yet I decided I needed to go back... I am just struggling with the database connection, even using the repair tool.  I am just probably not naming it correctly.

I have changed the settings to "backup_smf"
and the database created backup_smf

Can you tell me where I might be going wrong?  I just don't follow how you rename the database bit - when you say prefix, do you mean the original name of the database followed by backup_smf without _in front or what?  Help! :D

Did you choose for the upgrader to backup the tables prior to the backup? Did you do any backup at all btw, prior to the upgrade?

I chose to backup the database before upgrading to RC2

I have tables in my phpadmin files called backup_smf_

In that case all you gotta do is to upload the files of the version you had before you did the upgrade, then open the Settings.php file and change the db prefix in there to the backup_ smf and you should be all set.

CerebralJam

Thanks - I am nearly there.  I did upload all the files and then ran the repair_settings.php.  I missed the prefix on the settings, and only saw the db name, so that was my mistake.

I now have most of it working - except two of the mods when I click on the menu the buttons do not go to the mod.

I can see all the things I need in admin section so that is all there, just the link from the quiz to the quiz and the arcade to the arcade have seemed to have gone strange - any suggestions?

Norv

You might miss some files perhaps? Please note that sometimes FTP clients drop some files during transfer, and they don't necessarily tell it very visibly.
Try re-uploading the files, or let us know if you have some errors in the error log, as they might help understanding what can be wrong.
To-do lists are for deferral. The more things you write down the later they're done... until you have 100s of lists of things you don't do.

File a security report | Developers' Blog | Bug Tracker


Also known as Norv on D* | Norv N. on G+ | Norv on Github

CerebralJam


Advertisement: