Get category if used in a custom post type

This would work. As posted by @bucketpress.

$someposts = get_posts(
    array(
        'post_type' => 'work',
        'posts_per_page' => -1,
        'fields' => 'ids', // return an array of ids
    )
);

$somepoststerms = get_terms(
    array(
        'taxonomy' => 'category',
        'object_ids' => $someposts,
        'hide_empty' => true,
    )
);

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