Using Named Pipes

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

On Windows, using a named pipe for connection to the database is straightforward. It took a little while to get the (minimal) changes needed, so this information is intended to save you the trouble.

Why would you want to do this? If you're running your database server on the same machine as mediawiki, anyway, this lets you avoid having to open up a port for the database. Configure MySql to Use Named Pipes ==

This is not the default. To do this, make sure that in the "my.ini" mysql configuration file, you have "skip-networking" and "enable-named-pipe" under the "[mysqld]" element. Here's a snippet from the relevant lines in what worked for me (MySql4.1):

# ----------------------------------------------------------------------
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.




# ----------------------------------------------------------------------
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.


# The Pipe the MySQL Server will use

Configure LocalSettings.php[edit]

In your LocalSettings.php file, set $wgDBserver to "." (localhost will NOT work):

$wgDBserver         = ".";

That's it - well, it works for me with Windows XP Home Edition, Mediawiki 1.8.2, MySQL 4.1, and PHP 5.2.0.