Get users primary blog URL in MultiSite

There’s actually a function for that: get_active_blog_for_user() https://developer.wordpress.org/reference/functions/get_active_blog_for_user/

$user_id = get_current_user_id();
$user_blog = get_active_blog_for_user( $user_id );
echo $user_blog->siteurl;

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