wordpress_password_reset
This is an old revision of the document!
- | wpreset.sh
#!/usr/local/bin/bash # Wordpress Password Reset # <Ketan Patel> k2patel@hotmail.com if [ $# -lt 2 ] then echo "Usage: $0 <Blog Location> <new Password> [<Admin User>]" elif [ $# -lt 3 ] then WPUser='admin' else WPUser=$3 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
wordpress_password_reset.1288482566.txt.gz · Last modified: 2020/08/10 02:29 (external edit)