How to get category slug link? ( include parent categories)

my solution:

$catid='24'
$cats = get_category ($catid);
if ($cats) 
    {$category_link = $cats->slug;
        if ( $parent = $cats->parent )
            {
            $category_link = get_category_parents($parent, false, "https://wordpress.stackexchange.com/", true) . $category_link;
            }
    }

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