I've got a multisite install using the multi-domain plugin, and has worked great since early versions of 3. I always set up the naked domain in WP, with an A record for the naked domain (@) pointing to the IP of my VPS. I then set a CNAME record for WWW that points to the naked domain. After I updated to 3.9 all of my sites still work fine when accessing via the naked domain, but if I try to access with www I get "Error establishing database connection". DNS queries show that my CNAME is resolving correctly, and it appears to be taking me to the WP multisite directory, but WP is no longer recognizing how to handle the site. It would previously just take me over to the naked domain version. I'm not using the domain mapping plugin.
Any ideas? I compared htaccess from backup prior to upgrade, but it looks the same.