After moving to localhost on the official domain, you may encounter a database connection error.

Solution to fix the wordpress multisite database error

wp-config.php settings for Fixing WordPress multisite database error problem

Open the wordpress wp-config.php file editor once more, and make sure that WP_ALLOW_MULTISITE is defined. If it isn’t declared, you can view the code block below by pressing the keyboard shortcut Ctrl + F (or Cmd + F on a Mac) and pasting the code WP_ALLOW_MULTISITE.

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'metaaffinity.net' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
//define( 'WP_ALLOW_MULTISITE', true ); // Remove this code or disable it:

.htacces file

Check that the code below for multisite is enabled by opening the .htaccess file in your editor.

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
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]
# END WordPress

If you follow this step for multisite, it will be solved.

Now it’s time to verify the MySQL database to confirm that the domain entries and paths have been entered correctly.

Example : Table name : wp_1_options

Here you will put your sub site path

Example : Table name : wp_site

Here you will put main domain name

Example : Table name : wp_blogs

add domain name and your site paths like if you have site1, site2 or site3

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.