Steve Holdoway wrote:
On Fri, 30 May 2008 11:18:49 +1200
Roger Searle <[EMAIL PROTECTED]> wrote:

Hi, I have a HH machine running in vmware that has mediawiki freshly installed and configured, I can browse to the main page of the wiki and could begin creating articles etc. I have a mysql backup of a wiki that I had previously when running Gutsy (which broke on upgrading to Hardy). I created this using the mysql administrator tool - creates a .sql dump file that I am now wanting to restore and replace the database of the freshly installed wiki. I can use the MySQL Administrator tool's Restore Backup function to do a restore, however I am lost at the point of understanding where this restored database has gone, but more importantly how to replace the database of the freshly installed wiki and therefore see the previously created articles. Any pointers on where to look or how to go about such a process would be greatly appreciated.
Cheers,
Roger

** Note: this is only guaranteed to work if the version of mediawiki has not 
changed **

The sql dump is a text file ( unless it's been zipped up in some way ), so you can look at what has been written. This is important, as the dump can optionally add code to select the database, replace the tables, etc.
I'm running a fairly old version of mediawiki, so this may have changed, but... 
database details are held in LocalSettings.php in the root of the website: 
$wgDBname, user, password, server. Take a note of these so you know what to 
populate.


Assuming the dumpfile doesn't create the database, then you need to... ( 
replacing dbname, user, password with the above values ).

make a backp of the current database.
mysqldump -u user -p dbname > mediawikibackup.sql
( enter password when prompted )

login to the mysql database mysql-u user -p
( enter password when prompted )
mysql> drop database dbname;
mysql> create database dbname;
mysql> \q

( don't bother creating the database if there's a line in the sql dump to do so 
).

repopulate the database
mysql -u user -p dbname < theoldbackup.sql
( enter password when prompted )

This is the hardcore way of doing it, and no matter the front end that's in use, these are the steps that are necessary.

hth,

Steve
Hi, I hope I have followed the above correctly, but have not quite managed to get this working, I think I'm probably close. The mysql commands drop and create the database - I did need to do "create database dbname" otherwise when repopulating with backup.sql it complains of there not being dbname. So now, when I try to view the wiki in a browser, I get:

Roger's Wiki has a problem
Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.
(Can't contact the database server: Access denied for user 'roger'@'localhost' to database 'wiki' (locahlost)

Is this a permission error somewhere? Google is full of this, but are pages having had the same error rather than useful info on how to solve. I also am guessing that I have a mis-match - or simply did not correctly understand what I should be doing - related to how the backup.sql dump is creating the database? I see that the text "Roger's Wiki" and 'wiki' (as in "database 'wiki' in the last line of the error) are coming from the LocalSettings.php file. backup.sql has the lines

CREATE DATABASE IF NOT EXISTS wiki;
USE wiki;

and numerous CREATE TABLE 'wiki'.''archive' type lines. This is the basis of me having $wgDBname="wiki" in LocalSettings.php

I may have gone off on the wrong track here - any more suggestions from anyone?
Roger

Reply via email to