Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => Install and Upgrade Help => Aiheen aloitti: moraidh - joulukuu 10, 2010, 03:00:07 IP

Otsikko: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 10, 2010, 03:00:07 IP
On changing to a new server for my website, I had to reupload the whole site.  With a new SQL database, I installed the lastest version of SMF, as I was operating 1.1.3 or something before (it would never update).

So, having backed up the forum database from the old forum, I was left wondering how to upload it.

From searching here, I gather I have to use MySQL.

Knowing next to nothing about MySQL, I logged in, and tried to import the database, and got errors when going to the forum address.  I deleted all the SMF files via FTP, reuploaded them, reinstalled SMF, then tried to import the no table variant of the database.

This time, I get all the proper boards and members, but when I go to a topic and click on it, I get:

Database Error
Unknown column 'a.file_hash' in 'field list'
File: /web1/user30812/website/forum/Sources/Display.php
Line: 711

I have used the forum maintenance options, but no luck.  I know I have probably made a hash of it all, but it hardly seems an easy thing to reinstall your boards!

Any help more gratefull appreciated!
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: Illori - joulukuu 11, 2010, 06:55:43 AP
are your files the same version as your database? if they are not you will need to upgrade the database to match the version of the files.

Upgrading SMF (http://docs.simplemachines.org/index.php?board=3.0;sort=subject)
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 11, 2010, 10:05:27 AP
The complete backup I had done, was on SMF 1.1.4 or something.

I see what you mean about the upgrade being a good idea, but the problem is that since the hosting upgrade, I had to reupload everything onto a new server, i.e. I got a clean slate, so I used the brand new clean install of the latest SMF and ran install.php (there was no existing SMF to upload an upgrade version and thus no "upgrade.php" to run.

So I'm still stuck!
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: Illori - joulukuu 11, 2010, 11:26:20 AP
if you put up your old database it will not work with the new smf code, download the large upgrade package and upload it, then you can run the upgrade.php script to fix your database.
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 12, 2010, 06:58:48 AP
OK, I deleted the complete install version, and uploaded the major upgrade, ran upgrade.php and got this:

Warning: require_once(/web1/user30812/website/forum/Settings.php) [function.require-once]: failed to open stream: No such file or directory in /web1/user30812/website/forum/upgrade.php on line 87

Fatal error: require_once() [function.require]: Failed opening required '/web1/user30812/website/forum/Settings.php' (include_path='.:') in /web1/user30812/website/forum/upgrade.php on line 87:


Line 87: require_once($install_path . '/Settings.php');

Line 87 in this file makes reference to Settings.php, which isn't in the upgrade version of SMF, presumably being present from an upgrade on an earlier version.  So the upgrade version of SMF is maybe not suited for a clean install?

Is there any hope here, or do I have to resign myself to having to start the forum from scratch?
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: Illori - joulukuu 12, 2010, 07:00:00 AP
you should NEVER delete that file, it has the database connection information for your forum to work, try to restore it then upgrade.
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 12, 2010, 07:04:07 AP
Yes, what I said originally was - I was allocated a brand new server - i.e. a clean slate with no SMF on it, so all I had was the complete back up from the forum on the old server, so I didn't actually delete it personally.

I will try to add this file from the complete SMF and see if it helps.  If not, what can I do?
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: Illori - joulukuu 12, 2010, 07:05:53 AP
you need a copy of the file that is filled out and has the database connection information in it already.
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 12, 2010, 07:07:04 AP
OK, I uploaded it and got this message on running upgrade.php

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /web1/user30812/website/forum/upgrade.php on line 93

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /web1/user30812/website/forum/upgrade.php on line 93
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: Illori - joulukuu 12, 2010, 07:08:28 AP
is the server for the database correct for the new host?
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 12, 2010, 07:11:18 AP
This is line 93:

$db_connection = mysql_connect($db_server, $db_user, $db_passwd) or die(mysql_error($db_connection));

So if I replace these withe username and password it should work?  Or do I have to specifiy what these variables are in another file or at the beginning of Settings.php?
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: Illori - joulukuu 12, 2010, 07:13:22 AP
they should be in settings.php

something like this


########## Database Info ##########
$db_server = 'localhost';
$db_name = 'smf';
$db_user = 'smf';
$db_passwd = 'passwordhere';
$db_prefix = 'smf_';
$db_persist = '0';
$db_error_send = 1;
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 12, 2010, 07:19:45 AP
OK I'll look for that.  The previous Settings.php wouldn't have been any good, as all the details are new anyway.  Thanks for your continued help!
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 12, 2010, 07:33:48 AP
OK, the upgrade seemes to have worked ok after I added those values to Settings.php and uploaded it (together with Settings.bak)

My forum has appeared, but when I click on a topic I get:

http://127.0.0.1/smf/index.php?board=31.0

Obviously I have ot change 127.0.0.1 to by domain name (or IP address????) somewhere.  Is this in Settings.php too?
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 12, 2010, 07:38:27 AP
OK, I located and changed the URL in Settings.php.

My gosh - my forum seems to work!  Can it really be true!!

All the old boards and posts are there, presumably they were still in the db somewhere from by previous abortive restorations?

Small issue: Where would I find old avatars for members?  Are they in the backup somewhere, or do they have to upload them again?
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: Illori - joulukuu 12, 2010, 08:12:46 AP
please run What is repair_settings.php? (http://docs.simplemachines.org/index.php?topic=663.0) to verify all paths are set to your new domain. they should be in the avatars folder or separate folder if you changed that setting.

all posts/topics/users/settings should be there from the database restore/upgrade.
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: moraidh - joulukuu 12, 2010, 01:30:51 IP
Things seem to be ok again (apart from what I posted here (http://www.simplemachines.org/community/index.php?topic=412900.0)), so many thanks illori!
Otsikko: Re: Upgrade / Database help please!
Kirjoitti: JimM - joulukuu 15, 2010, 09:16:56 IP
If this is solved, please mark it solved by clicking the Mark Topic Solved link at the bottom left.