Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Multi-Site and database connection errors WordPress

I have a site set up to use Multi-site wildcard subdomains.

It was working fine the other day.

The problem is that when I create a new subdomain site, everything appears to be successful and wordpress tells me the blog was created, but when I visit the URL to the new site, I get a standard,

"Error establishing database connection"

This doesn't make sense because it is using the same database as the main site. The main site works, I am able to create users, add content, etc...

I have ensured that the mysql user has all priviledges.

It makes absolutely no sense that only subdomain sites would cause the database connection error. Furthermore, sites that were previously created as subdomains are still working. It's only new sites that don't work.

I read somewhere that for multi-site you cannot have your main site with "www" in it. Is this true?

Answers (5)


Reland Pigte answers:

Sub-domain sites work with the use of wildcard subdomains. This is a two-step process:

Apache must be configured to accept wildcards.
Open up the httpd.conf file or the include file containing the VHOST entry for your web account.
Add this line:
ServerAlias *

In the DNS records on your server, add a wildcard subdomain that points to the main installation. It should look like:
A *

Dan | gteh comments:

already done that.

ServerAlias * already there.

DNS entry for * as a CNAME to

As I mentioned, this was working previously and there are already 3 subdomain sites that are working just fine.

I am just unable to create any new ones as of today.


Luis Abarca answers:

if you are using

You should also add DNS entries in a similar manner.

Dan | gteh comments:

I dont think that's the issue.

HEre is a better explanation.

About 3 subdomains were created a few days ago and work.

SO this is the structure.

Main domain:
Working subdomain:
working subdomain:
working subdomain:

These above all work.

Today I tried to create a bunch more subdomains. They all appear in my 'All Sites' list however none are functional

Broken subdomain:

When visiting the broken subdomain, I get a standard, "Error establishing database connection"

Why would the first 3 subdomains work, but the 4th throws a database connection error


fuscata answers:

Do you have the Defesio Anti-spam plugin installed? If so, disable it (I recommend moving the whole directory from wp-content/plugins to wp-content/plugins-disabled or similar), and try creating a new site.


MDan answers:

Hello, check this thread, maybe will make you realize where the problem is:
In the bottom of the page is the solution for that problem, maybe it will help you also


Gabriel Reguly answers:

Hi Dan,

This might be obvious, but did you added the sub domains to Domain Mapping?

I assume you are using WordPress MU Domain Mapping, correct?