3
07/11/2024 7:55 am
Topic starter
Hi, how can I create admin from my WordPress site by using MySQL?
Maybe with some queries?
Just want to use simple SQL query.
Thanks
1 Answer
1
07/11/2024 7:57 am
My WordPress database is called childhood so you MUST change the name of yours + the other information (just replace it).
My new admin username is opa and the password is also opa (it will be hashed using MD5 hashing method).
Also, I’m giving the user id the value of 2. Make sure this isn’t already used in your database.
Here is the code (SQL query):
INSERT INTO `childhood`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('2', 'opa', MD5('opa'), 'Opa', 'your@email.com', 'http://www.yoursite.com/', '2018-06-07 00:00:00', '', '0', 'Alex'); INSERT INTO `childhood`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '2', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); INSERT INTO `childhood`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '2', 'wp_user_level', '10');
Here is a screenshot from my PHPMyAdmin with the new admin user:
Also - this video is very useful for understanding WordPress Database with phpMyAdmin + how to work with some of the SQL queries: