Super admin access to a forgotten WP instance?

I have inherited a WordPress instance backed by a MySQL database, hosted on a bare bones server. I have SSH access to the server, and I can even log in with an old set of credentials to the admin panel. But the login I have does not allow me to install plugins, which I now must do.

Given I have the keys to the kingdom, but no knowledge, how can I either find the login for the old super admin or convert the user I can log in as into a super admin?

I’m comfortable with raw SQL, I’m just not familiar with WordPress at all.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Note: Super Admins only have meaning in WordPress Multisite. I’ve assumed below that you’re running Multisite, though your question isn’t tagged as such.

Super Admins are stored as a serialized array in the {$prefix}_sitemeta table in the site_admins record. In my local installation, with only the user ID adminpj as a Super Admin, here’s what I see:

mysql> SELECT meta_key, meta_value FROM wp_sitemeta WHERE meta_key='site_admins';
+-------------+--------------------------+
| meta_key    | meta_value               |
+-------------+--------------------------+
| site_admins | a:1:{i:0;s:7:"adminpj";} |
+-------------+--------------------------+

Unserializing the meta_value, I get:

Array (
    [0] => adminpj
)

So you can either a) see what your existing Super Admins are, or b) add your own username to the site_admins record.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x