Add WordPress MU Network Admin via Database

I am working on getting a copy of a WordPress MU network up and running on my local machine for development purposes (using WordPress 3.2.1 at the moment). I need access to the network administration options.

In the usermeta table, I changed my user-level to 10 and capabilities to a:1:{s:13:"administrator";b:1;}

In the sitemeta table, I added myself to the serialized array of users in the site_admins option.

While this did get me access to the generic wp-admin page, I still do not have access to any of the network admin options (such as automatic upgrade for WP, plugins, or themes, etc).

Solutions Collecting From Web of "Add WordPress MU Network Admin via Database"

So, it turns out that those three changes were all that were needed. It also turns out that if any of the serialized arrays are modified incorrectly (which is easy to do when modifying them by hand), the system will just assume you are not a network administrator.

Correcting the serialized array for the site_admins option fixed the problem.

Just in case the format for the serialised array in meta_value where meta_key='site_admins' in the sitemeta table isn’t clear to someone (like it wasn’t clear to me).

a:5:{i:0;s:5:"admin";i:1;s:9:"user12345";i:2;s:4:"user";i:3;s:5:"user1";i:4;s:8:"user1234";}

a:5 at the beginning of the array indicates that the array has five elements.

Each element’s length is also indicated by s:x, where x is the length of the array element. For example, the admin username length is shown by s:5

Here is the queries to create a new admin user :

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('newadmin', MD5('pass123'), 'firstname lastname', 'email@example.com', '0');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');


INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

It will definitly help you. 🙂

I had been struggling with this issue for days, ie. When I updated the domain name of my main network site, the network admin option disappeared from the dashboard. Tried to look all over the place. Finally ended up on this question and once I read locoMotion’s explanation of what the fields in sitemeta table mean, I noticed that the length of the username for the superadmin was not correct. When I fixed that, the SiteAdmin menu started showing up on the dashboard again. Thanks @quadium32 for asking this question and special thanks @locoMotion for explaining what the sitemeta values mean. Best Regards. Tariq