Reset your wordpress password

You lost your wordpress password. Darn. Upload this PHP file to your wordpress folder (not the wp-admin, but the one with wp-config in it). Then, browse to this PHP file and zap your password(s).

File: reset-me.php

<html> <head> <title>Reset your Wordpress password</title> </head> <body> ERASE THIS PAGE WHEN DONE! Or rename it or hide it away so someone else doesn't use it! <p> <?php // reset your wordpress password... // 2010 (c) Rudy Rucker, Jr. include_once('wp-config.php'); // ** MySQL settings ** // //define('DB_NAME', 'xxx'); // The name of the database //define('DB_USER', 'xxx'); // Your MySQL username //define('DB_PASSWORD', 'xxx'); // ...and password //define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value function quote_it($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not integer if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } echo "<h2>Wordpress password fix</h2>" ; $connection = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD); if (! $connection) { echo 'Could not connect: ' . mysql_error($connection); exit; } echo "Connected to database as " . DB_USER . " on " . DB_HOST . "<p>" ; if (! mysql_select_db(DB_NAME)) { echo "Could not find database: " . mysql_error($connection); exit; } echo "Connected to " . DB_NAME . "<p><hr>" ; if (isset($_GET['ppp']) and is_numeric($_GET['pppid'])) { $sql="UPDATE ${table_prefix}users SET user_pass=MD5(" . quote_it($_GET['ppp']) . ") WHERE ID=" . $_GET['pppid'] . " LIMIT 1"; // echo " About to run: <i>$sql</i><br>\n"; $result = mysql_query($sql); if ($result != 1) { echo "Didn't work... SQL I tried:<br><i>$sql</i><br>\n"; } else { echo "<h3>Success</h3>"; echo "updated " . $_GET['pppname'] . "'s password to " . $_GET['ppp']; } } else { $sql="SELECT ID, user_login, user_pass FROM ${table_prefix}users"; echo "Finding users... <i style='color:red; font-size:0.7em'>$sql</i><p>\n"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo "<form><input name=pppname type=hidden value=$row[1]>"; echo "<input name=pppid type=hidden value=$row[0]>"; echo "<input type=text name=ppp> echo "<input type=submit name=go value='New Password for $row[1]'> ehco "</form><br>\n"; echo "<!-- $row[2] ==>"; } } ?> <p> <small><a href=http://monkeybrains.net/>MonkeyBrains!</a>