How are roles stored in the database?

The core functions:

  • is_super_admin(),
  • grant_super_admin(),
  • revoke_super_admin()

fetch the super admins data from the wp_sitemeta table with:

$super_admins = get_site_option( 'site_admins', array( 'admin' ) );

It’s stored as a serialized array of user logins, for each site, like:

a:1:{i:0;s:6:"louiev";}

It’s possible to override it with the global $site_admins array.

On the other hand, the general user roles (admin, editor, author, …) are stored as serialized arrays, for each user, like:

a:1:{s:13:"administrator";b:1;}

in the wp_usermeta table under the wp_capabilities meta key and/or the wp_{$blog_id}_capabilities meta keys.

Note that the wp_ prefix might be different on your install.