This shows you the differences between two versions of the page.
wordpress_password_reset [2010/10/30 23:20] k2patel created |
wordpress_password_reset [2020/08/10 02:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | <code bash | wpreset.sh> | ||
- | #!/usr/local/bin/bash | ||
- | # Wordpress Password Reset | ||
- | # <Ketan Patel> k2patel@gmail.com | ||
- | if [ $# -lt 2 ]; then | ||
- | echo "Usage: $0 <Blog Location> <new Password>" | ||
- | exit 1 | ||
- | fi | ||
- | |||
- | RESET="UPDATE wp_users SET user_pass=MD5('$2') WHERE user_login='admin'" | ||
- | |||
- | cd $1 | ||
- | |||
- | DBNAME=`grep DB_NAME wp-config.php | cut -d "'" -f 4` | ||
- | DBPASS=`grep DB_PASSWORD wp-config.php | cut -d "'" -f 4` | ||
- | DBHOST=`grep DB_HOST wp-config.php | cut -d "'" -f 4` | ||
- | DBUSER=`grep DB_USER wp-config.php | cut -d "'" -f 4` | ||
- | |||
- | if mysql -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME -e "$RESET" | ||
- | then | ||
- | echo "new password set to '$2'" | ||
- | else | ||
- | echo "Failed!!" | ||
- | fi | ||
- | |||
- | exit | ||
- | </code> |