Get the path of the first attached media (single.php)

I tried to write some snippet with the help of WordPress codex. Please check below and update it further as per your needs. I hope this helps:

global $post;

$args = array(
    'numberposts' => 1,
    'order' => 'ASC',
    'post_mime_type' => 'image',
    'post_parent' => $post->ID,
    'post_status' => null,
    'post_type' => 'attachment',
);

$attachments = get_children( $args );

if ( $attachments ) {
   foreach ( $attachments as $attachment ) {
      $image_attributes = wp_get_attachment_image_src( $attachment->ID, 'full' );
      echo wp_get_attachment_url($attachment->ID);
      echo '<img src="' . wp_get_attachment_thumb_url( $attachment->ID ) . '" class="current">';
}
}

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