MyBB Community Forums

Full Version: Can't Restore backup?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm upgrading from 1.8.6 to 1.8.24 with a clean installation.

Previously I backed up the database (selected everything) and used the default settings.

Now, when I try using phpmyadmin to import the sql.gz the following error message is presented;


Error

SQL query:

-- MyBB Database Backup
-- Generated: 11th February 2021 at 16:26
-- -------------------------------------


CREATE TABLE `mybb_adminlog` (
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`ipaddress` varbinary(16) NOT NULL DEFAULT '',
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
`module` varchar(50) NOT NULL DEFAULT '',
`action` varchar(50) NOT NULL DEFAULT '',
`data` text NOT NULL,
KEY `module` (`module`,`action`),
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8


MySQL said: Documentation
#1050 - Table 'mybb_adminlog' already exists

How can I fix this?

Thanks
The MyBB database backup doesn't have a drop table if exist directive - if memory serves.  So when you try to restore to an existing database and the import routine has create table, you'll hit this error.

Couple of ways to fix this - but more concerned about restoring an older database to a new install.  You realise all your template css code is in the database?  If you fix the import issues, you'll reintroduce older template code, but with newer php files.  Never mind custom graphics and attachments.

MyBB support might be able to recommend a way to get around this - but I don't suggest trying short cuts from the recommended upgrade path.  I personally upgraded from 1.8.6 to what was current last year.  Did it in 2 increments, but using the full package as documented.  Yes, had some issues, but mainly because of customisation to our theme:

https://docs.mybb.com/1.8/install/upgrade/
Too confusing.

Is there a way to just backup and restore the forum structure and posts?

No solution.

Is it advisable to upgrade by going up a few versions at a time rather?

If I can't import a backed up database I don't know what to do.
I think this has been made more complicated by trying to do a clean install first.

Upgrading by doing a clean installation first is a pointless exercise - all "installing" does is create new empty database tables, so when you then import the backup, it'll be exactly as it was before, and you'll still need to run the upgrade script, so installing a clean board first doesn't actually achieve anything.

It sounds like the theory was that by installing 1.8.24 fresh and then importing your 1.8.6 database, it'd be upgraded? That's not how the process works - it's not just a case of uploading the new files to upgrade the board, the database needs to be upgraded to work with the new files as well, so a 1.8.6 backup won't work with 1.8.24 files straight away.

There's also no real way to "only backup forums and posts" - you need threads, and users, and a ton of other information across different tables. I'm not sure why this would even be necessary or something you'd need or want to do?

It's also completely fine to upgrade many versions in one go, as long as you use the full download when going up more than 1 version - you could probably upgrade a version of MyBB 1.2 from 2007 to 1.8.24 no problem. Every version that requires database changes to go up to that version comes with a file of changes that it runs during the upgrade process, so it just runs all the steps it needs to to get you from version A to version B, whether that's 2 steps or 20.

Anyway, in terms of fixing this upgrade...

Seeing as you've re-installed a clean board, you'll just need to drop those empty tables, and then import the backup. Then, you'll need to go to yoursite.com/install/upgrade.php and follow the steps to upgrade the database. You'll have to pick your old version from the version selector (if it's not pre-selected), then just click Next a few times and it'll upgrade the database.
HOLY CATS!!!!!

I DID IT!!!!!

I can't believe this!!!  It works!

Man, I was sweating for weeks about this.

Here's what I did;

1- backed up the database using phpmyadmin (sounds like I know what I'm doing?)

2- downloaded and unzipped mybb 1.8.24

2a- deleted  the file here in /inc/settings.php

Using filezilla

3- From my computer I uploaded the contents of the mybb 1.8.24 Upload folder to my website's forum folder.

4- At my website, let's say, Simplesite.com/Forum   I entered Simplesite.com/Forum/install/upgrade.php

5- BANG......an error.....had to delete the "lock" file found in /install folder (using Filezilla)

6- Refreshed (hit F5) the website in step 4.

7- Followed the steps presented

8- Prayed.....prayed.....

9- Installation said, "completed"  (the cynic in me said, "yes, completed means destroyed".

10- Entered my forum's web address and.....couldn't believe it actually worked!!!

Thank you
Yes, you'll just need to select them all and choose drop tables from the options below. Or, you could just create a new database and change the database name in ./inc/config.php to use that and import the backup there, whichever is easier.

Nothing should go wrong with the upgrade process, it's very tried and tested at this point. And in the event something does go wrong, the backup can just be imported again and it can be retried. As long as there's a backup of the 1.8.6 database, it can always be restored.

You can backup the files if you wish, but it's not as important - you'll be overwriting the files with the 1.8.24 versions, but you could always replace them with the 1.8.6 versions again if necessary. Aside from you uploading the new files, the upgrade script itself doesn't do anything with the files at all.
Last comment....

Something is rather confusing. The upgrade process is simple and I am not techie (or want to be).

It's the upgrade process that gets somewhat confusing. Oh well....do it a few times per day and I'll be an expert (ha ha).
It shouldn’t be much different to the install process - if anything is should be simpler as there’s fewer steps. After uploading the new files over the old files, going to /install/upgrade.php will prompt you to log in and pick your old version, then you just need to keep clicking Next.