Get the terms of a custom taxonomy for a specific author in author template

First get a list of the author posts then loop over the each post and get the terms used ex:

function list_author_used_terms($author_id){

    // get the author's posts
    $posts = get_posts( array('post_type' => 'custom_post_type_name', 'posts_per_page' => -1, 'author' => $author_id) );
    $author_terms = array();
    //loop over the posts and collect the terms
    foreach ($posts as $p) {
        $terms = wp_get_object_terms( $p->ID, 'taxonomy_name');
        foreach ($terms as $t) {
            $author_terms[] = $t->name;
        }
    }
    return array_unique($author_terms);
}

//usage
echo implode(", ",list_author_used_terms(1));

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