Backup mediawiki

From GHER

Jump to: navigation, search

Contents

Connect to the MySQL server

Verify your that you have the password to access the database. The password can be found in /etc/mediawiki1.10/LocalSettings.php under $wgDBpassword.

$ mysql -u wikiuser -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
[...]
mysql> use wikidb
mysql> show tables;
+----------------------+
| Tables_in_wikidb     |
+----------------------+
| mw_archive           |
| mw_categorylinks     |
| mw_externallinks     |
| ..............       | 
+----------------------+
34 rows in set (0.00 sec)
mysql> quit;
Bye

Backup the wiki

The database

mysqldump wikidb -u wikiuser -p --skip-opt > mysqldump-wikidb-$(date +%Y%m%d-%H%M).sql

The uploads

tar -zcvf wiki-uploads-$(date +%Y%m%d-%H%M).tar.gz /var/lib/mediawiki1.10/upload

Restore

Somethink like (not tested):

mysql wikidb -u wikiuser -p  < file.sql


Migrate the wiki to another server

Backup wikidb on old server and transfer to new server:

mysqldump wikidb -u root -p --add-drop-table > mysqldump-wikidb-drop-table-new.sql
scp mysqldump-wikidb-drop-table-new.sql 139.165.106.21:~

Delete wikidb if an outdated version is present on new server:

mysql -u root -p
...
mysql> DROP DATABASE wikidb;
mysql> CREATE DATABASE wikidb;

Restore wikidb on new server:

mysql -u root -p wikidb < mysqldump-wikidb-drop-table-new.sql

Run mediawiki update script if version has changed:

cd /var/lib/mediawiki/maintenance
php update.php --aconf ../AdminSettings.php

Reset password

Reset mediawiki user password by issuing:

sudo php /usr/share/mediawiki/maintenance/changePassword.php --user="User" --password="password"

Subversion

Installing subversion

More infos

Personal tools