Getting the slug into a variable, how to echo that variable

Try this:

$post = get_post($post_id); 
$slug = $post->post_name;

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