When attempting to convert WordPress to a Multisite setup, I get the error:
Error establishing a database connection
I'm using WordPress 3.7.1 on Windows 7 with a WAMP server.
define('WP_ALLOW_MULTISITE', true ); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'localhost'); define('PATH_CURRENT_SITE', '/wordpress_test4/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);
RewriteEngine On RewriteBase /wordpress_test4/ RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L]
Navigate to http://localhost/phpmyadmin. Where it says create new database, choose a name for your database. Next, open up wp-config. php in the root of your wordpress folder, and update the four values shown below to reflect your new database.
This error means that your website files (on the webserver) are not able to connect to your database (on the database server). This article lists some common reasons this error could display on your site, including: Incorrect database credentials in your config file. The hostname isn't working.
You need to add to your wp-config.php
:
define('MULTISITE', true);
I had the same problem. I skipped this line because I already had define('WP_ALLOW_MULTISITE', true);
in my wp-config and it looked to me the same.
Had same problem, found 3 possible solutions:
Make sure: DB_NAME
, DB_USER
, DB_PASSWORD
, and DB_HOST
in your wp-config.php are really the ones expectected.
As Dima L. mentioned before, define('MULTISITE', true);
is expected too.
But what solved it for me* is etting up multi-site for WordPress, changed the wp_blogs
table's column path
to an undefined location for my website. I changed it to /
and the DB connection was re-established.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With