Add a Super Admin User in phpMyAdmin

Sometimes when you work with WordPress multisite network you may need to create a super administrator user not from the dashboard, but from the database with the help of SQL queries.

And in this tutorial I am about to show you how. There are actually only two steps we need to do:

Create an Administrator User in phpMyAdmin

So, everything begins with creating a regular administrator first. We need 2 SQL queries for that.

In this first one we’re just creating a user:

INSERT INTO wp_users ( user_login, user_pass, user_nicename, user_email, user_url, user_registered, display_name)
VALUES ( 'rudrastyh', MD5('myPasswrd'), 'rudrastyh', '', '', '2023-04-14 09:25:20', 'Misha Rudrastyh' );

Then we must assign this user some capabilities.

INSERT INTO wp_usermeta (user_id, meta_key, meta_value)
VALUES ( 2, 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}' )

Please don’t forget to replace 2 with the actual user ID you’ve just created.

wp_users database table
wp_users database table.

Wait. Aren’t we talking about WordPress Multisite right now? Why we are working just with a regular WordPress database wp_users and wp_usermeta columns? If questions like this appear in your mind, I recommend you my another tutorial about multisite database structure.

Make a User Super Admin

This one actually can be a little bit tricky.

Infomation about super admins in a multisite network is stored as site meta in wp_sitemeta table. In a single option. Most likely this option already exists. It means that we can use an UPDATE SQL query and replace the existing super admins with our new one just like this:

UPDATE wp_sitemeta SET site_admins='a:1:{i:0;s:9:"rudrastyh";}' WHERE site_id=1;

Please note that after running this query all the existing super admins will stop being super admins! So maybe in your case it is better to change this option manually. But what is inside it? What is actually site_admins value?

It is simple – it is just a serialized array of usernames, for example Array( 'rudrastyh' ), or Array( 'misha', 'rudrastyh' ), so you can use serialize() PHP function or any kind of a online tool out there to convert it to a:2:{i:0;s:5:"misha";i:1;s:9:"rudrastyh";}. You you can even format it by yourself:

Misha Rudrastyh

Misha Rudrastyh

Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.

Need some developer help? Contact me

Follow me on X