Get Free Linux Server Security, Performance & Troubleshooting Tips

Change Joomla admin user password from MySQL CLI

Change Joomla admin user password from MySQL CLI
5 (100%) 4 votes

Question: How can I change the Joomla admin password via command line on Linux?
Answer: You can change Joomla admin user password using command line, yes, that’s possible using MySQL Shell.

If you lost your Joomla admin user password, you can reset it easily using command line. Let’s explore how to do it on the following tutorial.

Reset Joomla user password from MySQL CLI

You will only need to know what is the MySQL database associated with your Joomla website. Once you get that detail you can easily update / reset Joomla user password from the command line.




To get the database name, you will have to find Joomla configuration file. It is located at the root directory of your Joomla installation, usually at public_html/configuration.php. See the example below:

root@server.nixcp.com [/home/nixcp/public_html]# ls -l configuration.php
-rw-r--r-- 1 nixcp nixcp 3238 Jan 27  2017 configuration.php

That is the main configuration file for all Joomla installations.
Run this command to see the database connection details, that includes the database name.

more configuration.php

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

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

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




Login to MySQL prompt by running:

On cPanel servers:

mysql

On plain CentOS servers:

mysql -u root -p

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

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4091646
Server version: 5.6.33 Distributed by The IUS Community Project

Copyright (c) 2000, 2017, 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.

mysql>

Switch the Database to match your Joomla installation DB

mysql> use nixcp_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 you replace “your_password” with your new joomla admin user password you want to use from now on. And also make sure to replace your ‘admin’ user, in this example “admin” is the username I seelcted for the password change, but it could be any other user you need to change the password for.

That’s all, at this time you can test the joomla password by logging into the Joomla administrator interface from: www.yoursite.com/administrator. Do you know other ways to change Joomla admin user password from CLI? Please share your knowledge with us.

Leave a Reply

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