Fix WordPress broken database : capabilities / no role assigned

Solution:

You can do this with a single query. Please check before running that a:1:{s:13:”administrator”;b:1;} is the only value than need to be preservered. If there is others, add them in the query conditions.

UPDATE wp_usermeta
SET meta_value = ‘a:1:{s:10:”subscriber”;b:1;}’
WHERE
meta_key = ‘wp_capabilities’ AND
meta_value != ‘a:1:{s:13:”administrator”;b:1;}’