How can I make a user an administrator via the database?

This problem is certainly not so common. If you can’t log in to your WordPress website anymore, but you have access to the database, the following solution will help. (In the described case it would also be enough to reset the password).

In the table _users you create a new user. For the password field use the function “MD5”, so that the chosen password can be converted accordingly.

Afterwards you note the “ID” of the new user.

One changes then into the table _usermeta and creates for the new user a further entry. The user_id is known, the meta_key is _capabilities and the meta_value is a:1:{s:13: “administrator”;b:1;}.

Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.