How to get the uploaded image url in media_handle_upload()?

You can get it with:

wp_get_attachment_url();

More info in the codex

In your example:

$attachment_id = media_handle_upload( 'my_image_upload', $_POST['post_id'] );
$attachment_url = wp_get_attachment_url($attachment_id);
echo $attachment_url; 

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