I'm working on an autologin for Wordpress and everything was working really good, till I enabled my multisite and tried to use it when multisite is off it does its thing logs in and redirects to dashboard, but when I enable it trows
"Error establishing Database Connection"
What could be causing this?
Does multisite WordPress change the database URL?
Here is the code for you to see.
include'../wordpress/wp-load.php';
$errors = array();
$username = 'admin';
$password = '123456';
$remember = "true";
$login_data = array();
$login_data['user_login'] = $username;
$login_data['user_password'] = $password;
$login_data['remember'] = $remember;
$user_verify = wp_signon($login_data, true);
wp_set_auth_cookie($user_verify->ID);
wp_redirect(admin_url());
exit;
The database connection error message "Error establishing Database Connection" is a message from the
wpdb::db_connect()class method. If the method didn't properly handle the connection, this error is thrown.Turn on WP_DEBUG in your wp-config.php file to output more information to the screen. That should give you information on why the database is not connecting by outputting errors from PHP's
mysqli_connect()(which is what is being used to connect to the db).