PostgreSQL/MediaWiki

PostgreSQL is used as our database for a number of reasons, from stability to compatibility with other apps to support for JSONB values.

However, it is clearly not the most popular choice of database for Mediawiki, so we do make some workarounds to support this unique use case. These mods are noted below.

PostgreSQL with UNIX Sockets
As noted in the Mediawiki tutorial, you generally connect to the PostgreSQL over a TCP connection, and use  password authentication.

However, if the PostgreSQL database is on the same server, it's a better idea to dispense with the TCP overhead and connect to the UNIX socket directly.

First, make sure that you've set a password for the  superuser, so you can log into it without using   authentication, which we are going to switch to.

$ sudo su # must become root to become postgres user first $ psql postgres=# \password Enter new password: Enter it again: postgres=#
 * 1) su postgres

Next, we need to enable  authentication to the UNIX socket. On PostgreSQL 9.6 on Debian, edit the file  and change the following lines to match the below:

local  all             all                                     md5 host   all             all             127.0.0.1/32            md5 host   all             all             ::1/128                 md5
 * 1) "local" is for Unix domain socket connections only
 * 1) IPv4 local connections:
 * 1) IPv6 local connections:

On Debian, the PostgreSQL UNIX Socket is at, so in LocalSettings.php set these following lines (make sure to comment out  , which is not needed)

$wgDBtype = "postgres"; $wgDBserver = "/var/run/postgresql/.s.PGSQL.5432"; # UNIX port path
 * 1) Database settings


 * 1) Postgres specific settings
 * 2) $wgDBport = "5432"; # disable this