Run this script in phpMyAdmin or whatever tool you use to access MySQL:
SET @user_login := 'justin_foell';
SET @user_pass := 'Q9xiHgzZ';
SET @user_email := '[email protected]';
INSERT INTO `wp_users`
(`user_login`, `user_pass`, `user_email`, `user_registered`)
VALUES
(@user_login, MD5(@user_pass), @user_email, now());
SELECT @user_id := LAST_INSERT_ID();
INSERT INTO `wp_usermeta`
(`user_id`, `meta_key`, `meta_value`)
VALUES
(@user_id, 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
INSERT INTO `wp_usermeta`
(`user_id`, `meta_key`, `meta_value`)
VALUES
(@user_id, 'wp_user_level', '10');
Replace the set values at the top for @user_login
, @user_pass
and @user_email
with your own settings. Also, if your WordPress installation uses tables that start with a prefix other than wp_
, you’ll want to replace that in the table names as well.
From: https://9seeds.com/tech/inserting-yourself-as-admin-into-wordpress/