PHP Mistake – Whats wrong here?

From the official code reference:

wp_redirect() does not exit automatically, and should almost always be
followed by a call to exit;

So, you need to call exit after the redirect:

$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));

if ( get_user_role($curauth->ID) === 'subscriber' ):
    wp_redirect( 'http://redirect-here.com' );
    exit;  //here!
endif;

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