GICT knowledge base
Create New Admin Account in WordPress via MySQL
Published
In this tutorial, we can discuss how to create a new admin account in WordPress via MySQL.
1) Login to your cPanel account.
2) Select the icon ‘phpMyAdmin’ under the ‘Databases’ section.
3) A new window will open and here you can see the list of databases of your accounts on the left-hand side bar. Then click on the database for your particular WordPress installation.
4) After the database details are loaded, you need to click on the tab ‘SQL’.
5) After clicking on SQL, a SQL editor will appear. Add the following code to the SQL editor. Here the code creates a new admin account named ‘newadmin’ with the password ‘admin123’. You may change any of the content to fit your requirements.
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES (‘newadmin’, MD5(‘admin123’), ‘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’);
6) Then click on the button ‘Go’.
This should simply refresh the screen and you should see the message ‘1 row affected’ after each of the three SQL statements. This means the insertion ran smoothly. From here, visit your WordPress admin login and use the new admin login information. You should see admin interface without any issue.
If you need any further help please contact our support department.
Related guides
Check MariaDB Versions and Compatibility on Shared Hosting
Check your actual MariaDB/MySQL server version, maintenance coverage and application requirements before requesting a shared-hosting upgrade or move.
MySQLHow to Monitor MySQL Database Server Performance
Learn how to monitor MySQL performance with 4 essential Linux command-line tools.
MySQLHow to secure MySQL connections with SSL on Ubuntu
MySQL allows remote connections and we must protect data transfer happeneing between servers with SSL. Follow this tutorial to learn how.
MySQLHow to set up High Availability WordPress with HyperDB
HyperDB is a drop-in plugin that allows you to set up High Availability WordPress site that can work with multiple database servers at once.




