How to reset WordPress admin/users password from Linux command line?

1, Log into server as root.
2, Enter to MySQL command prompt.

[root@vps ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 265
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


3, Use WordPress database.

You can check the database name from the WordPress configuration file.

mysql> use user_images;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

4, Verify user details from “wp_users” table.

We need to select only the following details from “wp_users” table.

mysql> SELECT ID, user_login, user_pass FROM wp_users;
| ID | user_login | user_pass                          |
|  1 | admin      | $P$BjUKUieEYT1B3TnkQHsv4Y8hfnSK5t. |
1 row in set (0.00 sec)


This WordPress has only one user “Admin”. The password displayed here isn’t real, it’s in MD5 encrypted format.

5, Updating user password.

This is the point that we are looking for. As I mentioned, the password displayed is in MD5 format. In latest MySQL versions we can generate the password in MD5 format from the commandline itself. Please see the syntax:

mysql> UPDATE wp_users SET user_pass = MD5(‘WPEXPLORER’) WHERE ID=1 LIMIT 1;

In previous versions we have to enter the password in MD5 format. It’s simple, we can generate it from here >> MD5 <<

Syntax to change the password

mysql> UPDATE wp_users SET user_pass = "61250b88abfe298f2df4821d081a3add"  WHERE ID=1;

Here the user pass in MD5 format.

See the updated password:

mysql> SELECT ID, user_login, user_pass FROM wp_users;
| ID | user_login | user_pass                        |
|  1 | admin      | 61250b88abfe298f2df4821d081a3add |
1 row in set (0.00 sec)


Screenshot from 2015-04-25 19-55-07

That’s it!! Now try to login with the new password.

For more details, check the below url.


Plesk: mysql admin password

Since Version 10 it’s possible that the password of the mysql database of Plesk is, well they call it encrypted. This is basically fine, but may can run you in some trouble. For example if you like to install you own global phpMyAdmin installation and then try to log in as admin.

You’ll first try will be to use the same password as you will use when log in to Plesk. That will not work! Then you’ll may step over the ssh shell and type in

cat /etc/psa/.psa.shadow

This will give you something like


Yeah … that looks like the password is encrypted. As Plesk admin you know an other way to get the password

/usr/local/psa/bin/admin --show-password

This will output the password you already tried. Then you’ll dig around the internet and may find this cmd

mysql -uadmin -p`cat /etc/psa/.psa.shadow`

And … it’s working! You get access to mysql. Hmm … now you’re may a bit confuse. But thing about it. If you want to access your mysql database outside of Plesk you have to use the whole output of

cat /etc/psa/.psa.shadow

as password! Even if it look like it’s encrypted. This is your database password!
If you don’t like to have such a super long password and can live with a plain text password in the file /etc/psa/.psa.shadow you can change it back. But remember to repeat this every time you change the password via the Plesk panel :-)

/usr/local/psa/bin/init_conf -u -passwd 'some_password' -plain-password
Alternative you can add an other user with full admin rights to your database.

How to change cPanel password from command line

1) Access the server as a root user through SSH

2) Execute following command
# /scripts/chpass username password
username : cPanel account username
password : new password you wish to set
Note: password should not contain special characters
3) Synchronize the new password with the default FTP user
# /scripts/ftpupdate
If any feedback, queries are always welcome!

ERROR: /usr/local/cpanel/scripts/realchpass
Invocation changes only the system
password and does not have any effect
on other services associated with your
cPanel account, including FTP, SSH,
WebDAV, and FrontPage. It is strongly
encouraged for you to change the
password via the WHM & cPanel
interface. You can force a password
change through this script by setting
the environment variable




Create a MySQL Database, Username, Password, and Privileges from the command line

Create the Database


mysql > create database db_name;


 Create the User


mysql > create user db_user;


Grant privileges while assigning the password


mysql > grant all on db_name.* to 'db_user'@'localhost' identified by 'db_password';