SQL Query to List WordPress administrator Account Names

The SQL for selecting a list of WordPress users with the role of “administrator”:
SELECT um.user_id AS ID, u.user_login FROM wp_users u,
wp_usermeta um WHERE u.ID = um.user_id
AND um.meta_key = 'wp_capabilities'
AND um.meta_value LIKE '%administrator%' ORDER BY um.user_id

Simply use the above SQL Query via command line or through something like phpMyAdmin or your hosts’s SQL console to select a list of WordPress user accounts with the role of “administrator”.

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

Leave a Reply