How to change Joomla admin user password from MySQL CLI

Clients having Joomla based websites occassionaly forget their password. This is very easy to reset Joomla admin user password from MySQL CLI (command line interface).

You only need to know the MySQL database associated with that Joomla installation. You can easily find those details from Joomla configuration file .

Let’s explore how to do it in the following tutorial.

Reset Joomla user password from MySQL CLI

Configuration file is located at the root directory of your Joomla installation, usually at public_html/configuration.php. See the example below:

[/home/cppl/public_html]# ls -l configuration.php
-rw-r--r-- 1 cppl cppl 3238 Jul 14 2017 configuration.php

That is the main configuration file for all Joomla installations.
You can run following command to see the database connection details including database name.

more configuration.php

Keep pressing the space bar and looking until you find something like below:

public $db = 'cppl_joomla';
public $dbprefix = 'jos_';

Now you are good to change your joomla password. Follow the next steps to reset using the MySQL CLI:

Login to MySQL prompt by running:

On cPanel servers:

mysql

On simple CentOS servers you can run:

mysql -u root -p

Once you are in, you will see something like this:

Change the Database to your Joomla installation DB

mysql> use cppl_joomla;
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

List user information from “jos_users” database table

mysql> select * from jos_users;

Now you will be able to see all users information from here.

Change Joomla admin user password

mysql> UPDATE 'jos_users' SET 'password' = MD5( 'new_password' ) 
WHERE 'jos_users'.'username' = “admin” ;

Make sure to replace “new_password” with your new joomla admin user password. Here “admin” is the user name we selected for password change.

That’s it! Now you can test the joomla password by logging into the Joomla administrator interface from: www.yourdomainname.com/administrator.

Leave a Reply

Register to Get FREE Offers

Why Pay for Software when you can GET it for FREE

JOIN US TONIGHT!