How to get the role id from the role name?

Try buildin function get_users. The code should be like that:

$args = array(
    'role' => 'editor'
);
$editors = get_users($args);
foreach ($editors as $user) {
    echo '<li>' . $user->ID . '</li>';
}

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