{"id":967,"date":"2013-10-25T16:46:46","date_gmt":"2013-10-25T15:46:46","guid":{"rendered":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/?p=967"},"modified":"2013-10-31T18:11:48","modified_gmt":"2013-10-31T18:11:48","slug":"manually-add-a-user-to-your-wordpress-database","status":"publish","type":"post","link":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wordpress-hosting\/manually-add-a-user-to-your-wordpress-database","title":{"rendered":"Manually add a user to your WordPress Database"},"content":{"rendered":"<p>Normally you should never need to do this unless you have somehow removed your Admin user from your WordPress database, usually you will need to just reset your Admin user\u2019s password if you cannot login. But if you ever do need to re-add an Admin user to WordPress through phpMyAdmin this is how you would do it.<\/p>\n<p>The first thing you will need is access to the database so you will need to log into your websites cPanel control panel, then navigate to phpMyAdmin and locate the database for the WordPress installation. If you have forgotten the username, password, or even the name of the database you can find these details in your wp-config.php file which is in the root of your WordPress install.<\/p>\n<p>This information is found between lines 18 and 26 of the wp-config.php file, they will look like this:<\/p>\n<p style=\"padding-left: 30px;\"><strong>\/** The name of the database for WordPress *\/<\/strong><br \/>\n<strong> define(&#8216;DB_NAME&#8217;, &#8216;cpuser_yourwpdb&#8217;);<\/strong><br \/>\n<strong> \/** MySQL database username *\/<\/strong><br \/>\n<strong> define(&#8216;DB_USER&#8217;, &#8216;cpuser_yourdbuser&#8217;);<\/strong><br \/>\n<strong> \/** MySQL database password *\/<\/strong><br \/>\n<strong> define(&#8216;DB_PASSWORD&#8217;, &#8216;yourpassword&#8217;);<\/strong><\/p>\n<p>Select your database from the database select menu in phpMyAdmin. Your database will be loaded and you will now see a list of your database tables. You will need to change the wp_users and the wp_usermeta table. Click on the wp_users table to bring up the data for that table. You should see a list of the current users come up \u2013 or if you do not have any users you will see the list of database fields available.<\/p>\n<p>&nbsp;<\/p>\n<h2>Editing the wp_users table<\/h2>\n<p>We will need to insert a row into the database with our admin users\u2019 information. Click on the &#8220;Insert&#8221; tab in order to bring up the phpMyAdmin insert form. Insert the following information:<\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li>user_login \u2013 this is the username you want to use to access WordPress<\/li>\n<li>user_pass \u2013 this is the password you want to use to access WordPress (be sure to select MD5 from the phpMyAdmin Function menu \u2013 WordPress stores passwords with MD5 encryption)<\/li>\n<li>user_nicename \u2013 put whatever you would like to refer to yourself as in here (not your username)<\/li>\n<li>user_email \u2013 this is the email account associated with this user<\/li>\n<li>user_url \u2013 the url to your website<\/li>\n<li>user_registered \u2013 when was this user registered \u2013 just select a date with the date selector<\/li>\n<li>user_activation_key \u2013 you can leave this blank<\/li>\n<li>user_status \u2013 leave this set to 0<\/li>\n<li>display_name \u2013 usually this is set this to whatever the user_nicename is<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>Now that you have that information entered you will need to hit the &#8220;Go&#8221; button at the bottom of the phpMyAdmin window. You should be redirected to a page that shows the results of your query, if there are no errors then continue with editing the wp_usermeta table.<\/p>\n<p>&nbsp;<\/p>\n<h2>Editing the wp_usermeta table<\/h2>\n<p>So now that we have inserted our user, we will need to give it the privileges that it needs to access the WordPress Admin section. This is done through the wp_usermeta table. You will need to know the id of the user you just created. If you don\u2019t know the id now would be a good time to check the wp_users table for it. We will need to insert two rows into the wp_usermeta table, wp_capabilities and wp_user_level.<\/p>\n<p>&nbsp;<\/p>\n<p>Here are the steps you will need to follow to give your user privileges:<\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li>Click on the wp_usermeta table to bring up the entries.<\/li>\n<li>Click on the &#8220;Insert&#8221; tab to insert a new row.<\/li>\n<li>Fill in the following information\n<ol>\n<li>umeta_id &#8211; leave this blank it is automatically generated<\/li>\n<li>user_id \u2013 this is the id of the user you created in the previous steps<\/li>\n<li>meta_key \u2013 for this step insert wp_capabilities<\/li>\n<li>meta_value \u2013 insert exactly this \u2013 a:1:{s:13:&#8221;administrator&#8221;;b:1;}<\/li>\n<\/ol>\n<\/li>\n<li>Insert another row with this information\n<ol>\n<li>umeta_id &#8211; leave this blank it is automatically generated<\/li>\n<li>user_id \u2013 this is the id of the user you created in the previous steps<\/li>\n<li>meta_key \u2013 for this step insert wp_user_level<\/li>\n<li>meta_value \u2013 insert 10<\/li>\n<\/ol>\n<\/li>\n<li>Click the &#8220;Go&#8221; button in phpMyAdmin to insert the row.<\/li>\n<\/ol>\n<p>Now you should be able to login to your wp-admin page with the username and password you specified for this user. After logged in I would visit the Users section within WordPress, click edit on the user I just added, and click the Update Profile button at the bottom of the screen. This will allow WordPress to go through and add some more information and &#8220;clean up&#8221; the user we just added.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Normally you should never need to do this unless you have somehow removed your Admin user from your WordPress database, usually you will need to just reset your Admin user\u2019s password if you cannot login. But if you ever do need to re-add an Admin user to WordPress through phpMyAdmin this is how you would [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97],"tags":[158,108,23,157],"_links":{"self":[{"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/posts\/967"}],"collection":[{"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=967"}],"version-history":[{"count":12,"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/posts\/967\/revisions"}],"predecessor-version":[{"id":979,"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/posts\/967\/revisions\/979"}],"wp:attachment":[{"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=967"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ukwebsolutionsdirect.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}