Introduction
I sometime lose or forget the WordPress admin account password. (Account passwords and other information is stored in a MySQL table.) Here are MySQL commands that can be used to change WordPress account passwords.
A Windows Batch File That Executes The MySQL Command Line
If you are doing anything with MySQL on a windows system, it is sometimes nesessary (and usefull) to use the command line interface. The following windows batch file simplifies starting the command line interface.
Using notepad, copy to the following code to the file mysql.bat. Double click of the file and the command line will execute.
@echo off rem ========================================================= rem MySQL command line rem ========================================================= set MYSQL=C:\xampp\mysql\bin\mysql.exe %MYSQL% --table -h localhost -u root -padminpassword pause Note:
- In the batch file, MySQL is located at C:\xampp\mysql\bin\mysql.exe. Depending on how and where you installed MySQL, it may be in a different location.
- In the batch file, you are logging in as user root with password adminpassword.
Some Useful MySQL Commands
mysql> show databases; mysql> create database databasename; mysql> drop database databasename; mysql> use databasename; Change WordPress Account Password
mysql> use WPdatabasename; mysql> select Id,user_login,user_pass from wp_users where user_login="admin"; mysql> update wp_users set user_pass=MD5('newpassword') where Id=1;