手册:MySQL

From mediawiki.org
This page is a translated version of the page Manual:MySQL and the translation is 88% complete.
手册:索引 MediaWiki数据库布局 MySQL/zh

MySQL数据库引擎是MediaWiki最常使用的数据库后端。 MySQL曾是维基媒体基金会所使用的关系型数据库,因此它在MediaWiki上面获得很好的支持。 Much of the advice for MySQL and for MariaDB apply to each other.

See Compatibility#Database for a list of supported versions.

连接到MySQL

 mysql -u wikiuser -p my_wiki

wikiusermy_wiki更改为您的Wiki的用户名和数据库名称($wgDBuser $wgDBname )。 出现提示时,输入密码。

$ mysql -u root -p my_wiki
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 150
Server version: 5.6.24-0ubuntu2 (Ubuntu)
...

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>.

安裝

更多信息请参见Manual:Installing MediaWiki#Create a database

基本上,如果安装了MySQL,安装脚本会为你创建一个数据库。 只需给脚本提供你的MySQL的root密码(默认为空)。

警告 警告: 将root密码留空可能会严重影响到MediaWiki的安全性。 如果你还没有修改密码,你应该立马修改root密码。
如果要在ISP服务器上安装MediaWiki,则可能必须与其他一些应用程序共享数据库,这会增加MediaWiki与预先存在的表所需的数据库表之间发生冲突的风险。 要解决此问题,您可以指示MediaWiki使用表前缀,以便MediaWiki的所有表都以此前缀开头。 或者,如果您的ISP允许,请为驻留在服务器上的每个应用程序使用不同的数据库。

维护

你安装的MediaWiki中的/maintenance/目录下有一些维护脚本。 其中一些脚本用于刷新数据库的一部分作为一次性操作。

导入数据库

更多信息请参见手册:从XML备份文件文件导入

导出数据库

更多信息请参见手册:备份一个维基

参见

外部链接