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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
scroll top