Conor
Elite Member
- Nov 7, 2012
- 3,621
- 6,217
I've learnt a couple of pretty basic but useful things when it comes to Wordpress logins over the years. The sad truth is that due to the popularity of Wordpress, hackers have learnt a few things over the years too. Lucky for us, it's quite quick and simple to get back into a Wordpress site that's been hacked. So let's start:
Trick 1 - Changing the admin password in the database
This is the simplest way of doing it. Just access your database via PHPMyAdmin.
Navigate to the wp_users table, locate the admin user and click the Edit (pencil) icon.
Now, just type a recognisable password into the "user_pass" column, click the "Function" dropdown for that same column, and change it to "MD5" to encrypt the password.
Click "Go" to save your changes. You should be able to log in to your WP site properly again.
Trick 2 - Creating a new admin account in the database
(Credit for this trick goes to these guys.)
Click on your database in the left sidebar in PHPMyAdmin, and then click the "SQL" button at the top.
Paste the following code into the big text box that appears:
You'll need to change the code in red to your Username, Password, Name/Surname and email respectively.
The code in green is your database prefix. Make sure this matches your actual DB prefix, which is usually "wp_".
You're done! Just click "Go", and you should now be able to log into Wordpress with your brand new admin account.
Trick 3 - Accessing phpMyAdmin via WAMP
(Credit to this guy)
This one is pretty cool I think. You don't actually need access to cPanel, as long as you can get into the root FTP directory. Go to your wp-config.php file and make a note of the following values in red:
Go to your WAMP directory and locate config.inc.php in your phpmyadmin folder. (Mine is located at \wamp64\apps\phpmyadmin4.6.4\)
Paste the following code at the bottom of your file (Before the closing ?> tag of course):
Save the file and start WAMP. Navigate to localhost/phpmyadmin in your browser.
You should then see a dropdown, select your server and enter the username and password and you're in! No need for cPanel!
Trick 1 - Changing the admin password in the database
This is the simplest way of doing it. Just access your database via PHPMyAdmin.
Navigate to the wp_users table, locate the admin user and click the Edit (pencil) icon.
Now, just type a recognisable password into the "user_pass" column, click the "Function" dropdown for that same column, and change it to "MD5" to encrypt the password.
Click "Go" to save your changes. You should be able to log in to your WP site properly again.
Trick 2 - Creating a new admin account in the database
(Credit for this trick goes to these guys.)
Click on your database in the left sidebar in PHPMyAdmin, and then click the "SQL" button at the top.
Paste the following code into the big text box that appears:
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');
You'll need to change the code in red to your Username, Password, Name/Surname and email respectively.
The code in green is your database prefix. Make sure this matches your actual DB prefix, which is usually "wp_".
You're done! Just click "Go", and you should now be able to log into Wordpress with your brand new admin account.
Trick 3 - Accessing phpMyAdmin via WAMP
(Credit to this guy)
This one is pretty cool I think. You don't actually need access to cPanel, as long as you can get into the root FTP directory. Go to your wp-config.php file and make a note of the following values in red:
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
Go to your WAMP directory and locate config.inc.php in your phpmyadmin folder. (Mine is located at \wamp64\apps\phpmyadmin4.6.4\)
Paste the following code at the bottom of your file (Before the closing ?> tag of course):
$i++;
$cfg['Servers'][$i]['localhost'] = '';
$cfg['Servers'][$i]['username_here'] = '';
$cfg['Servers'][$i]['password_here'] = '';
$cfg['Servers'][$i]['auth_type'] = 'config'; // This is the authentication mode. Since we are doing this on localhost, it is safe to set is as config. You can read more about authentication types available here: https://wiki.phpmyadmin.net/pma/auth_types
Save the file and start WAMP. Navigate to localhost/phpmyadmin in your browser.
You should then see a dropdown, select your server and enter the username and password and you're in! No need for cPanel!