Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: Goofy68 on August 18, 2014, 05:04:37 PM

Title: Moving database
Post by: Goofy68 on August 18, 2014, 05:04:37 PM
Hi
I have been running my forum for few years and never had any problems. Due to my host having some problems I placed the database on another host.
A few weeks ago that host shut down and I lost the database. I do have a backup from a few months back which I hope I can use but the problem is I dont know how to do that.
I want to import the backup to my current host, the same as the forum host, and I think I can do that part. The problem is I dont know how to tell the forum that the database has moved since I cant access it now that the database is missing. I can access all my forumfiles through filezilla. Is there a file I can edit and change the path to the new location of my database?

Im not sure exactly what version Im running. I installed it maybe 5-6 years ago and have never uppgraded it :-[

Any help is very much apreciated.
Title: Re: Moving database
Post by: margarett on August 18, 2014, 05:13:14 PM
Ouch... Sorry to hear that :(

Depending on the size of the database, you might be able to import it via phpmyadmin or not... If it's a big database, the easiest solution is to upload the .sql file via FTP to where your files are and ask your host to import it.
Another solution is to use a staggered import tool like bigdump.php

In any case, after that database is imported, you just need to tell SMF to use it. Repair_settings can help you do that ;)

After you have it running, it's probably a good idea to update your forum, if you really never updated since original install.

Good luck ;)
Title: Re: Moving database
Post by: Goofy68 on August 18, 2014, 06:08:46 PM
Thankyou very much for your reply :)  The database is 18 MB. I suspect that is not considered big so I will try importing it using phpmyadmin.
I will download and have a go at repair_settings after that. :)
Title: Re: Moving database
Post by: kat on August 19, 2014, 01:32:00 PM
Let us know how you get on, Goofy!
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 03:20:38 PM
I have problems importing the database to my host. Could it be because the backup Im trying to import was made from within SMF controlpanel?
Im using phpmyadmin when I try to import it.
Title: Re: Moving database
Post by: kat on August 19, 2014, 03:26:07 PM
Damn. Could be. I'm afraid the backup utility, in SMF, is... er... crap, quite often, I'm afraid. It could be incomplete or corrupt. :( My own opinion is that the facility shouldn't even exist, to be honest.

How good's your host? Could they have an older backup?

In your CPanel, do you happen to have "R1Soft Restore Backups" in the "Files" section? If you have, you might be lucky, coz that gives to access to backups.
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 03:26:28 PM
I get the following error: 

SQL-fråga:

# ==========================================================
#
# Database dump of tables in `robeabmark_se`
# 2013-12-24, 11:32:29
#
# ==========================================================
#
# Table structure for table `smf_attachments`
#
DROP TABLE IF EXISTS  `smf_attachments` ;


MySQL sa: Dokumentation

#1046 - No database selected
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 03:29:04 PM
Unfortunately my host do not have any backups  :'(
I was hoping I would be able to use the one I created in SMF.
Title: Re: Moving database
Post by: kat on August 19, 2014, 03:33:46 PM
Clutching at straws time...

What if you go to Admin>Backups and try to restore, from there?

Probably no different. But...
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 03:35:09 PM
Quote from: K@ on August 19, 2014, 03:33:46 PM
Clutching at straws time...

What if you go to Admin>Backups and try to restore, from there?

Probably no different. But...

The problem is that the database was on another host that is now shut down. All I have is the SMF backup.
Title: Re: Moving database
Post by: margarett on August 19, 2014, 03:43:22 PM
What that error says is that you didn't select a database for the import.
So you need to choose a database first (maybe create one) and then choose to import ;)
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 04:07:53 PM
Quote from: margarett on August 19, 2014, 03:43:22 PM
What that error says is that you didn't select a database for the import.
So you need to choose a database first (maybe create one) and then choose to import ;)

Now I managed to create an empty database and get this error when I import the backup:

# ==========================================================
#
# Database dump of tables in `robeabmark_se`
# 2013-12-24, 11:32:29
#
# ==========================================================
#
# Table structure for table `smf_attachments`
#
DROP TABLE IF EXISTS  `smf_attachments` ;


MySQL sa: Dokumentation

#1142 - DROP command denied to user 'Goofy68_goofy68'@'212.97.134.1' for table 'smf_attachments'
Title: Re: Moving database
Post by: margarett on August 19, 2014, 04:12:48 PM
That's related to the MySQL user you configured for that database. It has no permission to perform some commands. That MySQL user will also be used by SMF so you need to fix that ;)
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 04:57:46 PM
Quote from: margarett on August 19, 2014, 04:12:48 PM
That's related to the MySQL user you configured for that database. It has no permission to perform some commands. That MySQL user will also be used by SMF so you need to fix that ;)

Thanks for your replies. I changed all permissions and now Im actually being able to start import but with a new error this time.

SQL-fråga:

INSERT INTO `smf_log_search_subjects` (`word`, `ID_TOPIC`) VALUES ('premi�rracet', 363), ('prenois', 1532), ('presentation', 1042), ('print', 1570), ('privat', 1180), ('prix', 1015), ('pro', 579), ('pro', 1528), ('pro', 1581), ('problem', 371), ('problem', 556), ('problem', 602), ('problem', 628), ('problem', 654), ('problem', 1333), ('problem', 1621), ('program', 224), ('projektor', 46), ('promenad', 1417), ('protest', 571), ('protest', 572), ('protester', 1083), ('protesterna', 574), ('prova', 180), ('punktering', 130), ('putnam', 1480), ('p�', 13), ('p�', 34), ('p�', 41), ('p�', 54), ('p�', 63), ('p�', 77), ('p�', 78), ('p�', 82), ('p�', 84), ('p�', 90), ('p�', 91), ('p�', 92), ('p�', 95), ('p�', 96), ('p�', 97), ('p�', 124), ('p�', 126), ('p�', 128), ('p�', 132), ('p�', 136), ('p�', 137), ('p�', 138), ('p�', 148), ('p�', 149), ('p�', 177), ('p�', 184), ('p�', 195), ('p�', [...]

MySQL sa: Dokumentation

#1062 - Duplicate entry 'p-688' for key 'PRIMARY'
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 05:13:04 PM
This is the result after import so far. Looks like its not complete?
Title: Re: Moving database
Post by: margarett on August 19, 2014, 05:16:05 PM
No, it isn't... There is a duplicate error which is a PITA :(

Try to edit your .sql file with Notepad++ and find this:

INSERT INTO `smf_log_search_subjects`

Make it:
INSERT IGNORE INTO `smf_log_search_subjects`

Then try to import it again.
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 05:29:23 PM
Getting late over here. I followed your advice and got another error. Its getting late over here. I will continue tomorrow. Thanks for your support.

SQL-fråga:

INSERT INTO `smf_log_search_subjects` (`word`, `ID_TOPIC`) VALUES ('premi�rracet', 363), ('prenois', 1532), ('presentation', 1042), ('print', 1570), ('privat', 1180), ('prix', 1015), ('pro', 579), ('pro', 1528), ('pro', 1581), ('problem', 371), ('problem', 556), ('problem', 602), ('problem', 628), ('problem', 654), ('problem', 1333), ('problem', 1621), ('program', 224), ('projektor', 46), ('promenad', 1417), ('protest', 571), ('protest', 572), ('protester', 1083), ('protesterna', 574), ('prova', 180), ('punktering', 130), ('putnam', 1480), ('p�', 13), ('p�', 34), ('p�', 41), ('p�', 54), ('p�', 63), ('p�', 77), ('p�', 78), ('p�', 82), ('p�', 84), ('p�', 90), ('p�', 91), ('p�', 92), ('p�', 95), ('p�', 96), ('p�', 97), ('p�', 124), ('p�', 126), ('p�', 128), ('p�', 132), ('p�', 136), ('p�', 137), ('p�', 138), ('p�', 148), ('p�', 149), ('p�', 177), ('p�', 184), ('p�', 195), ('p�', [...]

MySQL sa: Dokumentation

#1062 - Duplicate entry 'p-688' for key 'PRIMARY'
Title: Re: Moving database
Post by: margarett on August 19, 2014, 05:40:42 PM
It's the same error. Are you sure you modified the file? Because it seems you are running the same query ;)
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 06:27:58 PM
YES :) now the import worked and my site is up and running again :) :) :) :)
I did another search and discovered that the line you asked me to replace existed more than once :)

I can NOT thank you enough for all your help. I was afraid that I had lost all the information but I didnt. I am so happy now :) :)

I wish I could buy you a beer :)

Thanks again for your patience and good advice. I am really impressed and grateful. Now I will make sure I make backups more often. I will make double backups in the future, in SMF and in phpmyadmin.

I will sleep well tonight :)
Title: Re: Moving database
Post by: Goofy68 on August 19, 2014, 06:53:08 PM
By the way, just checked and Im running SMF 1.1.2 and Tiny Portal v0.9.7. I guess I should read up on how to upgrade right away :)
Title: Re: Moving database
Post by: margarett on August 20, 2014, 04:58:46 AM
Yes, you really should. 1.1.2 is ancient :P
Unfortunately, you're up for a lot of work... It's unlikely you can patch all versions from 1.1.2 until 1.1.19... You can try, in any case ;)

If that fails, you need to use the large upgrade package. That implies to reinstall all your themes and mods, including TP. If you go down this path, then maybe you can consider upgrading to 2.0.8 since the 1.1.x series will become unsupported when 2.1 comes out...
Title: Re: Moving database
Post by: kat on August 20, 2014, 06:26:55 AM
Nicely done, there, Bruno!