In the event of a change of username for the database used by the wordpress site, check in the wp-config.php file in /var/www/sitename that the new username corresponds to that defined in the section :
/** Database username */
define( ‘DB_USER’, ‘new_username‘ );
Every setting of the database should match the ones defined in the file wp-config.php, unless it will not work at all.