Update post if exist from PHP

Try to use wp_update_post() in place of wp_insert_post for update.

$id = wp_exist_post_by_title($post['post_title']);

if($id !== false)
{
    $post['ID'] = $id["0"];
    // Create Post
    $post_id = wp_update_post( $post );
} else {
    $post_id = wp_insert_post( $post );
}

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