How to change Joomla admin user password from MySQL CLI?

Is it possible to change the admin password of Joomla CMS via Linux command line interface?

Yeah, it is possible to update/reset the user password from MySQL CLI (command line interface). The only thing you need to know is the MySQL database associated with that Joomla installation. You can find those details from its configuration file itself.

Configuration file is located under the website’s public folder. See the example pasted below:

[email protected] [/home/deweb/public_html]# ll configuration.php
-rw-r--r-- 1 deweb deweb 3238 Dec 31  2015 configuration.php

Configuration.php is the configuration file for the CMS Joomla. You will get the database and its prefix details from this file.

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

Yeah you are ready to change the password. Please do the following steps to reset it from Linux CLI:

Step 1 : SSH to server as root user

Step 2 : Enter to MySQL prompt.

# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 106439ss992 Server version: 5.6.33-cll-lve MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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 heir respective owners.

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

Step 3 : Change the DB to your Joomla’s DB

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

Step 4 : List user info from “jos_users” table

mysql> select * from jos_users;

You can see all user info from there.

Step 5 : Use the following command to update user password

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

Replace “new_password” with the actual password. Here “admin” is the user name we selected for password change.

That’s it!! Go to the administrator link ( and try to access it with the new password.

Please let me know if you have any questions.

Post navigation

Arunlal Ashok

Senior Operations Engineer (SRE) at NewFold Digital. Linux lover. Traveller. Father of two princesses.

Always happy for an open discussion! Write to arun ((@)) crybit ((dot)) com.

Leave a Reply

Your email address will not be published. Required fields are marked *