1

As part of a general tightening of security, I want to change the name of the admin user on my multisite install to something less commonly used. This user is admin on all five sites in the network and has the grand, exalted title of Super Admin on the network.

Using MySQL (technically MariaDB) to change the name...

update wp_users set user_login = "new_username" where ID = 1;
update wp_users set user_nicename = "new_username" where ID = 1;

... didn't pose much of a problem.

The problem I had was that when I now logged in with new_username I was no longer super admin. My user still had all his posts to his name, all his configurations and metadata etc. He was still admin on all five sites. But there was no way to access the network section of the control panel, i.e. the dropdown menu didn't list the network control panel, only that of the five sites.

This leads me to believe that there is some additional setting that links the super admin title to the admin user. I have travled the database looking for some clues as to where there might be some setting that names the super admin (and specifically names him "admin"?) but I have come up short.

Any suggestions?

NB: I know I can setup a new user and transfer all posts and responsibilities but that would open up a whole new can of worms, so if at all possible I don't want to go down that road. Also I would rather like to learn how my setup works on the db level.

EDIT: Based on the information supplied by user42826, I found that adding the following command to the two above did the trick:

update wp_sitemeta set meta_value = 'a:1:{i:0;s:5:"new_u";}' where meta_key = 'site_admins';

Note that 'new_u' is five characters, similarly to 'admin'. The new meta_value string was copy-pasted from the old string with the exception of 'new_u' replacing 'admin'.

  • 2
    If you have a fairly new installation of WP, you may be able to get away with direct db manipulation. You will need to update wp_users, wp_sitemeta, and wp_usermeta. The key tables are the last two. In wp_sitemeta, there is 'site_admins' metadata that contains all super admins. Note that it is serialized data so if you change the length of the admin username you could corrupt the entry. The recommended practice is to create a new user, add the user as a site admin, and delete the old admin account. – user42826 Feb 4 '14 at 18:05
  • Thanks, I'll have a poke-around but I can see I'll need to be sure I know what I'm doing in MySQL then. – brokkr Feb 5 '14 at 14:18
  • 1
    I hope you only had 1 super admin with your change above. Note that 's:5' means string length 5, if you increase the admin username length, you would need to change the '5'. Be aware that other plugins could be storing the old admin username. – user42826 Feb 5 '14 at 15:25
  • Yes, only 1. Thanks for the info - can you say where this is documented if any place? I get it, you're not supposed to meddle with this stuff, but... – brokkr Feb 6 '14 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.