Difference between revisions of "Mediawiki backup"

From Ever changing code
Jump to navigation Jump to search
(Created page with "Finally after multiple times I have backed up this and other mediawikis I am going to stream line this process. Any deviration I will record here to work out the best way of d...")
 
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:


More to come....
More to come....
= Recreate wiki database =
Create a new MySQL database and grant your user account permissions on the database. SELECT, INSERT, UPDATE and DELETE permissions should suffice.
mysql -u root -p<span style="color: blue">password</span>
CREATE DATABASE wikidb ;
CREATE USER wikiuser;
USE wikidb;
GRANT SELECT ON wikidb.* TO wikiuser;
GRANT UPDATE ON wikidb.* TO wikiuser;
GRANT INSERT ON wikidb.* TO wikiuser;
GRANT DELETE ON wikidb.* TO wikiuser;
If a database exists and you want to entirely replace it from the backup. To destroy the database, the -p parameter will prompt you for the password:
mysqladmin -u [userid] -p drop [wikidbname]
Then to create a new database:
mysqladmin -u [userid] -p create [wikidbname]
To import dbdump.sql from the command line do:
sudo mysql -u [userid] -p<span style="color: blue">password</span> [databasename] < dbdump.sql


= References =
= References =
*[http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki Backing up a wiki]
*[http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki Manual:Backing_up_a_wiki]
*[http://www.mediawiki.org/wiki/Manual:Moving_a_wiki Manual:Moving_a_wiki]
*[http://www.mediawiki.org/wiki/Manual:Restoring_a_wiki_from_backup Manual:Restoring_a_wiki_from_backup] From_the_command_line_using_mysql

Latest revision as of 21:59, 18 June 2014

Finally after multiple times I have backed up this and other mediawikis I am going to stream line this process. Any deviration I will record here to work out the best way of doing so. Maybe even the outcome will be a simple script.

More to come....

Recreate wiki database

Create a new MySQL database and grant your user account permissions on the database. SELECT, INSERT, UPDATE and DELETE permissions should suffice.

mysql -u root -ppassword
CREATE DATABASE wikidb ;
CREATE USER wikiuser;
USE wikidb;
GRANT SELECT ON wikidb.* TO wikiuser;
GRANT UPDATE ON wikidb.* TO wikiuser;
GRANT INSERT ON wikidb.* TO wikiuser;
GRANT DELETE ON wikidb.* TO wikiuser;

If a database exists and you want to entirely replace it from the backup. To destroy the database, the -p parameter will prompt you for the password:

mysqladmin -u [userid] -p drop [wikidbname]

Then to create a new database:

mysqladmin -u [userid] -p create [wikidbname]

To import dbdump.sql from the command line do:

sudo mysql -u [userid] -ppassword [databasename] < dbdump.sql

References