Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Paffman on May 25, 2020, 12:11:15 PM

Title: How to restore a saved Database
Post by: Paffman on May 25, 2020, 12:11:15 PM
Sorry Admin, I have posted in the wrong board, I started in the 1.1.x support board  :-[

So I have better start again here.

Long story short, my SMF forum got hacked. I have created a new SMF installation and now wish to restore my saved DB.

The DB I have is either a .sql or a complete_date.sql Which one do I need to upload?

When I get one to upload and then run repair_settings, I need to change the prefix in repair_settings to the prefix of the uploaded DB. How do I find the uploaded DB priefix so that I can change it in the repair_settings?

Also I have been approached via a message from someone offering to fix the issue for a fee, is that wise?

Steve
Title: Re: How to restore a saved Database
Post by: Sir Osis of Liver on May 25, 2020, 12:35:08 PM
Answered in your original topic.  You shouldn't have to pay anyone to fix this, you're almost there.
Title: Re: How to restore a saved Database
Post by: Paffman on May 25, 2020, 12:39:03 PM
Quote from: Sir Osis of Liver on May 25, 2020, 12:35:08 PM
Answered in your original topic.  You shouldn't have to pay anyone to fix this, you're almost there.


Sorry posted in the wrong board so thought I'd better start again.

So what DB do I need to upload?
****_***.sql or ****_***-complete_date.sql

And where can I find the old DB prefix to add to the repair_settings file?
Title: Re: How to restore a saved Database
Post by: Sir Osis of Liver on May 25, 2020, 12:44:18 PM
You need a complete backup of the original database.  Depending how you dumped it, the .sql can have different names.  As neither of those files is zipped, they should be pretty much the same size.  Use the one with most recent date.  Once you've imported the dump, you can view the db with phpmyadmin and you'll see the table prefix.
Title: Re: How to restore a saved Database
Post by: Paffman on May 25, 2020, 12:44:39 PM
Just been back to the OP in the wrong board.

"Just import the database backup into the new (empty) database you created for the new install, then run repair_settings."

How do I import the saved DB into the empty newly created DB?
Title: Re: How to restore a saved Database
Post by: Paffman on May 25, 2020, 12:48:08 PM
I have been trying to use this cpanel
Title: Re: How to restore a saved Database
Post by: Doug Heffernan on May 25, 2020, 12:53:06 PM
Quote from: Paffman on May 25, 2020, 12:11:15 PM

Also I have been approached via a message from someone offering to fix the issue for a fee, is that wise?

Steve

Were you approached, or did you aproach others first? I am asking because in my case, you have approached me first in private asking me to fix this for you. And I told you that if you would like me to get involved in actually restoring the backup, I would charge a fee for my time.

Anyways, you have been told a lot of time by several users as to what to do and looking from your replies to our suggestions, I would say that yes, it is wise to hire someone or find someone who can do it for free, to actually do this for you. Otherwise you are going to go in circles endless asking about stuff that have been answered 100 times.


Title: Re: How to restore a saved Database
Post by: Sir Osis of Liver on May 25, 2020, 01:15:19 PM
Cpanel restore will not restore a cpanel backup to a database with a different name.  You should be able to import it using phpmyadmin if it's not too big.  How large is the .sql?

If you can't get it, PM me with cpanel access, I'll do it tonight.
Title: Re: How to restore a saved Database
Post by: Paffman on May 25, 2020, 03:05:07 PM
Sorry didn't mean to upset you doug_ips, I was unsure about letting people into my cpanel  :-[

Anyway, I have managed to import my saved DB into the new SMF DB. I have run repair_setting but am unsure what to do now.

See attached.
Title: Re: How to restore a saved Database
Post by: Paffman on May 25, 2020, 03:08:56 PM
A lot of backup files in the new DB, changed the prefix for the restored DB and now get this... Do I now need to install the theme?

See attached
Title: Re: How to restore a saved Database
Post by: Kindred on May 25, 2020, 03:34:15 PM
Shows that you have the right database and prefix now... but the wrong paths.

Eun repair_settings.php again. Correct the URLs and file paths
Title: Re: How to restore a saved Database
Post by: Doug Heffernan on May 25, 2020, 04:06:17 PM
Quote from: Paffman on May 25, 2020, 03:05:07 PM
Sorry didn't mean to upset you doug_ips, I was unsure about letting people into my cpanel  :-[

You did not upset me. I was simply making a correction of your statement.
Title: Re: How to restore a saved Database
Post by: Paffman on May 25, 2020, 04:09:10 PM
Quote from: Kindred on May 25, 2020, 03:34:15 PM
Shows that you have the right database and prefix now... but the wrong paths.

Eun repair_settings.php again. Correct the URLs and file paths

Thanks, I have run repair_settings again and taken a look and everything looks OK. The path looks OK and all folders/contents seem to be there.
Title: Re: How to restore a saved Database
Post by: Paffman on May 25, 2020, 05:00:49 PM
I have corrected the paths and now have the structure/boards up and running, unfortunately no pictures work, but at least the information is there. Many, many thanks for all your help, your patience in helping me, it was a steep learning curve, but in the main it is working. Just got to get the bells and whistles and avatars working.

For future reference, how do I backup the database and pictures, avatars etc? And how do I make SMF secure?

Thank you so much.

Steve
Title: Re: How to restore a saved Database
Post by: a10 on May 25, 2020, 05:53:30 PM
Good job! About backups:

Attachments, avatars, all forum related files > FTP program (if using Filezilla, first set transfer type to binary !!!)
Start with a complete backup of the entire forum directory.
Later (regularly) complement it with newer files (new attachments etc).
IMO, do fresh backup of forum files before forum updates, late night experiments, mod installations.

Database > phpMyAdmin (available through cpanel) > export (see attach.). 1 click.
Do it regularly. One may also export individual tables (for editing and subsequent import).
Title: Re: How to restore a saved Database
Post by: Paffman on May 25, 2020, 08:13:39 PM
Lovely, thanks great info, thanks  8)
Title: Re: How to restore a saved Database
Post by: Kindred on May 25, 2020, 09:06:18 PM
If you are  not getting images, then the directories are wrong
Title: Re: How to restore a saved Database
Post by: Sir Osis of Liver on May 25, 2020, 09:25:53 PM
Or attachments were backed up as ascii and are corrupt.
Title: Re: How to restore a saved Database
Post by: Paffman on May 26, 2020, 07:57:00 AM
I think that is the fact that I didn't backup the images. I assume that the images are not saved in the DB backup?
Title: Re: How to restore a saved Database
Post by: @rjen on May 26, 2020, 01:13:45 PM
Nope , they are in the attachment folder. You need to backup those using FTP: they are not in the database...
Title: Re: How to restore a saved Database
Post by: Paffman on May 26, 2020, 01:34:14 PM
Quote from: a10 on May 25, 2020, 05:53:30 PM
Good job! About backups:

Attachments, avatars, all forum related files > FTP program (if using Filezilla, first set transfer type to binary !!!)
Start with a complete backup of the entire forum directory.
Later (regularly) complement it with newer files (new attachments etc).
IMO, do fresh backup of forum files before forum updates, late night experiments, mod installations.


Hey,

I understand and have done DB backups via phpMyAdmin. But how do I make a backup of the forum directory? In cpanel I have the option of partial or complete, complete is everything on my server space for moving hosts. The partial is for Home Dir, mySQL DB or email forwarders/filters.

Can I not go to cpanel> file manager and just copy the forum folder?
Title: Re: How to restore a saved Database
Post by: a10 on May 26, 2020, 02:13:51 PM
QuoteBut how do I make a backup of the forum directory?
Can I not go to cpanel> file manager and just copy the forum folder?
Yes. But:
Quote from: a10 on May 25, 2020, 05:53:30 PM
Attachments, avatars, all forum related files > FTP program (if using Filezilla, first set transfer type to binary !!!)
Start with a complete backup of the entire forum directory.
Later (regularly) complement it with newer files (new attachments etc).
IMO, do fresh backup of forum files before forum updates, late night experiments, mod installations.

Get started using FTP, very useful 'double' file manager, shows both your computer content & the server content, drag, drop, transfer, delete, rename etc files. Watch transfer queues etc. Configure ftp setup, features and views to suit one's needs.

May look complicated in the beginning, then it quickly becomes THE tool.
https://filezilla-project.org/client_screenshots.php

Your host supplies username & password for ftp.
Personally I never ever opened or visited the host's cp file manager (in 15 years!), ftp is so much better as a tool.
Title: Re: How to restore a saved Database
Post by: Sir Osis of Liver on May 26, 2020, 04:30:52 PM
Don't think you can download directories with cpanel file manager, just single files, but you can zip the entire forum or just the /attachments directory and download the zip.  FileZilla is much better and faster for managing files.

Title: Re: How to restore a saved Database
Post by: Paffman on May 26, 2020, 07:38:03 PM
I have used FTP.

So if I download a complete server space worth, abt 7GB, I could then pick a folder to upload say, packages if it all goes wrong?

Shame I can't just download the forum folder with out all the other stuff.
Title: Re: How to restore a saved Database
Post by: Sir Osis of Liver on May 26, 2020, 11:39:52 PM
Well, yes you can, either with filemanager or ftp.
Title: Re: How to restore a saved Database
Post by: a10 on May 27, 2020, 05:52:51 AM
^^^ Click on the forum folder, drag it over to your chosen location on pc.
1 second of work from your part, ftp will do the rest.
Title: Re: How to restore a saved Database
Post by: Paffman on June 05, 2020, 08:16:37 PM
Thank you all for your help  8)