Is there a hook that triggers when grant secondary user role in WordPress?

If whatever is adding the second role is going through standard methods: WP_User::add_role() then there’s the add_user_role hook:

/**
 * Do something whenever a new role is added to an existing user
 * 
 * @param String $role
 * 
 * @return void
 */
function wpse327081_add_uer_role( $role ) {

    // Do Things

}
add_action( 'add_user_role', 'wpse327081_add_uer_role', 10 );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)