Meidawiki is a good tool to organise the information and knowledge. I even use it to keep some notes. My first mediawiki was established like in 2012. There are some important informations in my database. Therefore I hope to keep it and run it in every Laptop. This blog keeps the steps on how to install and backup it.
I installed the mediawiki in Elementary OS (Ubuntu), so steps of installing mediawiki are like:
sudo apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-php5
There are two ways to do that:
sudo apt-get install mediawiki (this will install a low version)
step1: download an upgraded version:
extract them and put them into /var/lib/mediawiki
step 2: Create a database ( in mysql )
Check and see if the database server is running; for example, run
If it is not, run mysqld_safe to start it:
sudo /usr/local/mysql/bin/mysqld_safe &
Set a password for the “root” account on your database server.
/usr/local/mysql/bin/mysqladmin -u root password yourpassword
Run the MySQL command-line client:
/usr/local/mysql/bin/mysql -u root -p
Run command in the mysql command-line:
create database wikidb;
problem? sometimes this message may show up:
connection error: Access denied for user 'root'@'localhost' (localhost)
In my case, I found a solvation:
sudo mysql -u root
step3: go to 127.0.0.1/mediawiki in your browser, follow the steps.
All information are restored in mySQL database, so backup it with command:
mysqldump -u[user] -p[password] [databasename] > [dump_name]
In my case, it goes like:
mysqldump -u root -p wikidb >wikidb.mysql
My database is in wikidb.mysql. And I do not want to do this by typing them in the terminal. In replacement, I use crontab, edit crontab:
with a new task:
0 12 * * 1 mysqldump -u root -p wikidb >/home/junxie/work/wikidb.mysql
This means to run backup command in the noon every Monday.
If you move in to another computer, after installing the mediawiki, run the following commend to restore the backup one.
mysql -u[user] -p[password] [database_name] < [dump_name]
In my case, it is:
mysql -u root -p wikidb <wikidb.mysql
Have fun ^_^