{"id":153782,"date":"2016-04-08T11:00:48","date_gmt":"2016-04-08T15:00:48","guid":{"rendered":"http:\/\/premium.wpmudev.org\/blog\/?p=153782"},"modified":"2016-04-08T00:52:29","modified_gmt":"2016-04-08T04:52:29","slug":"getting-back-into-wordpress-admin-after-hack","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/getting-back-into-wordpress-admin-after-hack\/","title":{"rendered":"Hacked? How to Get Back Into the WordPress Admin"},"content":{"rendered":"<p>So your website has been hacked and you can\u2019t log in, no matter what username and password combination you try. Fortunately, you\u2019re not completely screwed \u2013 your database offers a convenient backdoor to help you regain access.<\/p>\n<p>If you find that your site has been hacked, or you\u2019ve simply forgotten your password and the admin email for your account is no longer valid, you can find that trying to recover your password from the login page doesn\u2019t work.<\/p>\n<p>In this kind of predicament, you\u2019ll be glad to know that as long as you can log in to your database, you can make simple changes to your account details so you can log back into your site.<\/p>\n<p>In this article, I\u2019ll show you how to change your admin user details in your database using phpMyAdmin so you can regain access to your site and administrator privileges.<\/p>\n<h2>Getting Started<\/h2>\n<p>Before you make any changes to your database, it&#8217;s important that you create a backup of your entire site or at least your database, though, obviously, this bit can be tricky if you don&#8217;t have access to your site. Many backup tools require you to have access to the backend of your site. So how do you get around this very important detail?<\/p>\n<p>If you don&#8217;t already have a method in place for creating regular backups of your site, you can still backup your database using phpMyAdmin. It won&#8217;t include everything on your site but it&#8217;s better than having no backup at all.<\/p>\n<p><em>For the next few steps, I&#8217;m going to assume you&#8217;re logging into your site via cPanel (although you can also access it via <a href=\"https:\/\/wpmudev.com\/blog\/manage-all-your-wordpress-sites-with-the-hub\/\" target=\"_blank\" rel=\"noopener\">The Hub<\/a>).<\/em><\/p>\n<p>In cPanel, go to <strong>Databases &gt; phpMyAdmin<\/strong> and select your site or network&#8217;s database on the left, then click the <strong>Export<\/strong> tab toward the top of the page.<\/p>\n<p>The default options are usually fine so it&#8217;s not necessary to choose the custom settings option.\u00a0Click <strong>Go<\/strong> to select a location on your computer to save and create your backup.<\/p>\n<figure class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-490x490\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2016\/04\/export-database.png\" alt=\"The &quot;Export&quot; page in phpMyAdmin.\" width=\"490\" height=\"312\" \/><figcaption class=\"wp-caption-text\">You can backup your database by exporting it in phpMyAdmin.<\/figcaption><\/figure>\n<p>If you make a mistake and need to restore your database, you can do this by going back to phpMyAdmin and clicking on your database listed on the left.<\/p>\n<p>At the bottom of the page, click the checkbox to select all your tables, then choose the <strong>Drop<\/strong> option in the drop-down box next to the checkbox.<\/p>\n<p>Next, click on the <strong>Import<\/strong> tab, then the <strong>Choose file<\/strong> button. Select the file you previously exported and click <strong>Go<\/strong> to restore your database.<\/p>\n<p>Your database should function the way it did when you created the backup. Still, if you can backup your entire site, it&#8217;s recommended you do so to make sure you don&#8217;t lose anything.<\/p>\n<figure class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-490x490\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2016\/04\/import-database.png\" alt=\"The &quot;Import&quot; page in phpMyAdmin.\" width=\"490\" height=\"312\" \/><figcaption class=\"wp-caption-text\">You can restore your database with the Import tool in phpMyAdmin.<\/figcaption><\/figure>\n<p>You might want to check out some of our posts about plugins that can create full backups of your site:\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/backup-with-snapshot\/\" target=\"_blank\" rel=\"noopener\">How to Backup Your WordPress Website (and Multisite) Using Snapshot<\/a>,\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/multisite-backup-solutions\/\" target=\"_blank\" rel=\"noopener\">4 Top WordPress Multisite Backup Solutions Tested and Reviewed<\/a> and\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/premium-freemium-wordpress-backup-plugins\/\" target=\"_blank\" rel=\"noopener\">7 Top Premium and Freemium WordPress Backup Plugins Reviewed<\/a>.<\/p>\n<h2>Updating Your Database<\/h2>\n<p>Once you have your backup saved, you can log in to phpMyAdmin through cPanel. Go to <strong>Databases &gt; phpMyAdmin<\/strong> and click on your site&#8217;s database on the left, then on the <code>wp_users<\/code> table that&#8217;s listed.<\/p>\n<p>Find your admin username on the list, then click the <strong>Edit<\/strong> button on the same line.<\/p>\n<div  class=\"wpdui-pic-regular  \">\n<figure class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-735x735 size-735x735\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2016\/04\/edit-table-admin.png\" alt=\"The wp_users table list.\" width=\"735\" height=\"300\" \/><figcaption class=\"wp-caption-text\">Click the <strong>Edit<\/strong> button to change the account details.<\/figcaption><\/figure>\n<\/div>\n<p>Next, change the email address in the <code>user_email<\/code> field. Make sure to change it to an address that&#8217;s valid and that you can access (you can set up a different email address on your domain with <a href=\"https:\/\/wpmudev.com\/email-hosting\/\" target=\"_blank\" rel=\"noopener\">email hosting<\/a>). When you&#8217;re done making the switch, click the <strong>Go<\/strong> button at the bottom of the page to save your changes.<\/p>\n<div  class=\"wpdui-pic-regular  \">\n<figure class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-735x735 size-735x735\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2016\/04\/change-email.png\" alt=\"The table fields for changing a user.\" width=\"735\" height=\"300\" \/><figcaption class=\"wp-caption-text\">Update your email address so you can recover your account.<\/figcaption><\/figure>\n<\/div>\n<h2>Review and Recover Your Site<\/h2>\n<p>Now that your new email address has been added to your account, all you need to do to regain access to the backend of your site is:<\/p>\n<ul>\n<li>Go to your login page (i.e. <code>http:\/\/www.example.com\/wp-admin<\/code>)<\/li>\n<li>Click the <strong>Lost your pass?<\/strong> link<\/li>\n<li>Enter the new email address you added to your database<\/li>\n<li>Click <strong>Get New Password<\/strong><\/li>\n<\/ul>\n<p>When you check your email you&#8217;ll find a\u00a0link to choose a new password. Be sure to choose a completely new and secure password.<\/p>\n<p>Once that&#8217;s all done, log in and review your site right away for any changes.\u00a0You should also consider restoring your site from a previous backup (if you have a backup and restore solution like <a href=\"https:\/\/wpmudev.com\/project\/snapshot\/\" target=\"_blank\">Snapshot<\/a> installed on your site) and\/or scanning your site for potential injections of\u00a0malicious\u00a0code with a tool like <a href=\"https:\/\/wpmudev.com\/project\/wp-defender\/\" target=\"_blank\">Defender<\/a>, VaultPress or Sucuri.<br \/>\nIf you&#8217;re not already running the latest version of WordPress, update your install right away in order to repair any security holes in your current version that have since been patched and included in the latest update.<\/p>\n<p>For more details on how to beef up the security of your site, check out\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/security-101\/\" target=\"_blank\" rel=\"noopener\">WordPress Security: Tried and True Tips to Secure WordPress<\/a> and\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/wordpress-security-tips\/\" target=\"_blank\" rel=\"noopener\">12 Ways to Secure Your WordPress Site You\u2019ve Probably Overlooked<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So your website has been hacked and you can\u2019t log in, no matter what username and password combination you try. Fortunately, you\u2019re not completely screwed \u2013 your database offers a convenient backdoor to help you regain access.<\/p>\n","protected":false},"author":54213,"featured_media":153848,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[263],"tags":[10810,1004,458,9834],"tutorials_categories":[],"class_list":["post-153782","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-wordpress-security","tag-database","tag-phpmyadmin","tag-user-accounts"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/153782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/54213"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=153782"}],"version-history":[{"count":20,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/153782\/revisions"}],"predecessor-version":[{"id":190979,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/153782\/revisions\/190979"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/153848"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=153782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=153782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=153782"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=153782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}