Skip to main content
added 1 character in body
Source Link
Robert hue
  • 8.6k
  • 2
  • 34
  • 50

Save this as new.sql file. Change wp_ suffix in this sql query with your wordpress database suffix. If you haven't change it then it will be wp_ by default.

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES ('newadmin', MD5('pass123'), 'firstname lastname', '[email protected]', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

And upload it to your server. Then from ssh use this command to create a new admin user.

mysql -uxxxxxxu username -p databasedatabasename < new.sql

replace xxxxxxusername (make sure you add -u before username) with your mysql username and databasedatabasename with your wordpress database. It will ask for mysql password.

On successful extenuation it will create a new admin user with

username: newadmin

password: pass123

Save this as new.sql file. Change wp_ suffix in this sql query with your wordpress database suffix. If you haven't change it then it will be wp_ by default.

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES ('newadmin', MD5('pass123'), 'firstname lastname', '[email protected]', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

And upload it to your server. Then from ssh use this command to create a new admin user.

mysql -uxxxxxx -p database < new.sql

replace xxxxxx (make sure you add -u before username) with your mysql username and database with your wordpress database. It will ask for mysql password.

On successful extenuation it will create a new admin user with

username: newadmin

password: pass123

Save this as new.sql file. Change wp_ suffix in this sql query with your wordpress database suffix. If you haven't change it then it will be wp_ by default.

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES ('newadmin', MD5('pass123'), 'firstname lastname', '[email protected]', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

And upload it to your server. Then from ssh use this command to create a new admin user.

mysql -u username -p databasename < new.sql

replace username (make sure you add -u before username) with your mysql username and databasename with your wordpress database. It will ask for mysql password.

On successful extenuation it will create a new admin user with

username: newadmin

password: pass123

Source Link
Robert hue
  • 8.6k
  • 2
  • 34
  • 50

Save this as new.sql file. Change wp_ suffix in this sql query with your wordpress database suffix. If you haven't change it then it will be wp_ by default.

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES ('newadmin', MD5('pass123'), 'firstname lastname', '[email protected]', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

And upload it to your server. Then from ssh use this command to create a new admin user.

mysql -uxxxxxx -p database < new.sql

replace xxxxxx (make sure you add -u before username) with your mysql username and database with your wordpress database. It will ask for mysql password.

On successful extenuation it will create a new admin user with

username: newadmin

password: pass123