Difference between revisions of "Add a wiki database"

From Organic Design wiki
m
(redo)
Line 5: Line 5:
 
}}
 
}}
  
== Usage ==
+
New wiki databases are added by copying from a template database for the version of MediaWiki the wiki will run on. A template exist for every code-base in the wikia because they get created during the [[install a MediaWiki code-base]] procedure.
  
'''Note:''' The databases referred to in the add-db command must pre-exist
+
If you intend on creating the new wiki in a new database, you'll first need to create the new database manually, for example by logging in to MySQL:
 
+
{{code|<sql>
{{code|
+
create database foo
<bash>
+
</sql>}}
add-db TEMPLATE DB1.PREFIX1 [DB2.]PREFIX2 [DB3.]PREFIX3...
+
You can then make a copy of the template database and define a table prefix for the new wiki tables using our [[add-db.pl|add-db script]] as follows. The best practice is that a table prefix should always be used even if there is only one wiki, and the prefix should always end with an underscore character.
</bash>
+
{{code|<sql>
}}
+
/var/www/add-db empty-1.13,sql foo.bar_ foo.baz_
 
+
</sql>}}
<pre>
+
In this example, two wiki databases have been added at one, both in the new "foo" database we created, one wiki has tables prefixed by "bar_" and the other by "baz_".
    Where,
 
        TEMPLATE is the name of the *.sql file or db.prefix to use as the template.
 
 
 
        DB*.PREFIX* are the databases to replicate the template into and the
 
        table prefixes to use (prefixes are mandatory).
 
</pre>
 
Notes:
 
*There is also an add-wiki script in MW maintenance dir which we need to check out
 
*The database dump being used as a template should only contain one wiki.
 
*It should not include create or drop database statements.
 
*The destination databases must already exist
 
*The destination tables will be replaced if they exist
 
*The DB part is optional for all but the first and means to continue using the previous database.\n"
 
  
 
== Next ==
 
== Next ==
After installing a wiki database, you can then [[Install a new wiki|install the wiki]].
+
After installing a wiki database, you can then [[install a new wiki]].
  
 
== See also ==
 
== See also ==
 +
*[[Install a MediaWiki code-base]]
 +
*[[Install a new wiki]]
 
*[[add-db.pl]]
 
*[[add-db.pl]]

Revision as of 23:47, 24 January 2009

Procedure.svg Add a wiki database
Organic Design procedure

New wiki databases are added by copying from a template database for the version of MediaWiki the wiki will run on. A template exist for every code-base in the wikia because they get created during the install a MediaWiki code-base procedure.

If you intend on creating the new wiki in a new database, you'll first need to create the new database manually, for example by logging in to MySQL:

<sql>

create database foo </sql>

You can then make a copy of the template database and define a table prefix for the new wiki tables using our add-db script as follows. The best practice is that a table prefix should always be used even if there is only one wiki, and the prefix should always end with an underscore character.

<sql>

/var/www/add-db empty-1.13,sql foo.bar_ foo.baz_ </sql>

In this example, two wiki databases have been added at one, both in the new "foo" database we created, one wiki has tables prefixed by "bar_" and the other by "baz_".

Next

After installing a wiki database, you can then install a new wiki.

See also