Moving MediaWiki

http://localhost/wiki/MediaWiki

Follow the steps here:

https://www.mediawiki.org/wiki/Manual:Moving_a_wiki

Step 1. Back up the database[^1], [^2]

# sudo mysqldump -h localhost \
               -u wikiuser -p \
               --default-character-set=binary wikidb \
	| xz -9v \
	> MediaWiki-NotreDame-AnthonyFok_mysqldump_2015-12-29.sql.xz

See https://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki#MySQL for the mysqldump command, and see https://www.mediawiki.org/wiki/Manual:$wgDBTableOptions for where I got the --default-character-set=binary from (my LocalSettings.php had it.)

Step 2. Back up the MediaWiki files

TODO… (I think I already lost them years ago, so…)

Step 3. Re-create the database, user and permissions

See https://www.mediawiki.org/wiki/Manual:Restoring_a_wiki_from_backup#Re-create_the_database.2C_user_and_permissions

On Debian:

sudo apt-get install mediawiki

After installation, edit /etc/mediawiki/apache.conf and add

Alias /wiki /var/lib/mediawiki

Then, open http://localhost/wiki/ in the browser, and follow the link to set up the wiki at http://localhost/wiki/mw-config/index.php

After selecting the language, if you see this:

警告:找不到APC、XCache或WinCache,無法啟用對象緩存。

Object caching is not enabled.

Do this:

sudo apt-get install php5-apcu
sudo service apache2 reload

And the message is gone.

If you see this:

警告:intl PECL擴展無法處理Unicode正常化,故只能退而採用運行較慢的純PHP實現的方法。如果您運行着一個高流量的站點,請參閱Unicode正常化一文。

Do this:

sudo apt-get install php5-intl
sudo service apache2 reload

And you will get this:

使用intl PECL擴展實現Unicode正常化。

連接到資料庫

Before this, do:

But it is problematic! Using the instruction there, I got 'notredame'@'%' rather than 'notredame'@'localhost' created… :-p

MariaDB [(none)]> CREATE USER 'notredame'@'localhost' IDENTIFIED BY 'my_password';
MariaDB [(none)]> USE notredame_wiki
MariaDB [notredame_wiki]> GRANT SELECT, UPDATE, INSERT, DELETE, USAGE ON notredame_wiki.* TO 'notredame'@'localhost';
MariaDB [notredame_wiki]> SHOW GRANTS FOR 'notredame'@'localhost';
資料庫名稱:
notredame_wiki (was my_wiki)
資料庫使用者名稱:
notredame

  • 存儲引擎:InnoDB
  • 資料庫字符集:二進制 (binary)