How to give guest users “not logged in” a role?

You need to add to the template directly or via a short code from PHP Snippets plugin.

Source: https://developer.wordpress.org/reference/functions/is_user_logged_in/

   <?php
if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!';
} else {
    echo 'Welcome, visitor!';
}
?>

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