How to get the post name (slug) from the item ID when traversing the navbar?

May be duplicate, but I wasn’t able to find the answer. $item->object_id stores the actual post ID:

$slug = get_post_field('post_name', $item->object_id);

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