How to get the_post_thumbnail caption?

Use the shortcode handler img_caption_shortcode to render the HTML for you, though you do need to pass it a width (which we can easily get with wp_get_attachement_image_src:

function wpse_138126_thumbnail_caption( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
    if ( $post = get_post( $post_thumbnail_id ) ) {
        if ( $size = wp_get_attachment_image_src( $post->ID, $size ) )
            $width = $size[1];
        else
            $width = 0;

        $html = img_caption_shortcode(
            array(
                'caption' => trim( "$post->post_excerpt $post->post_content" ),
                'align'   => 'alignright',
                'width'   => $width,
            ),
            $html       
        );
    }

    return $html;
}

add_filter( 'post_thumbnail_html', 'wpse_138126_thumbnail_caption', 10, 5 );

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