Multiblog WordPress: Eeek! No Database Connection

I tried browsing to this morning and was pretty sure I’ll get the usual redirect, but no. I got an “Error establishing a database connection”. Right, it seems that is not defined in the wp-config.php file we created earlier this week (Multiple Sites Driven By One WordPress Installation Part II) so here’s a workaround (and we’re switching back to and

$wp_multi = array(
    "" => array(
        "DB_NAME" => "example",
        "DB_USER" => "example-user",
        "DB_PASSWORD" => "example-pass",
        "DB_HOST" => "example-host"

    "" => array(
        "DB_NAME" => "example-two",
        "DB_USER" => "example-two-user",
        "DB_PASSWORD" => "example-two-pass",
        "DB_HOST" => "example-two-host"
$server_name = str_replace("www." , "", strtolower($_SERVER["SERVER_NAME"]));
$wp_settings = $wp_multi[$server_name];

There. And we also got rid of an error we’d get if we typed in the address bar.

I’m thinking of a way to wrap this up in some plugin or a little hack, or perhaps a super-short step-by-step tutorial, so that setting up multiple websites one a single wordpress bundle would be easier than ever. If you have any suggestions feel free to speak ;)