In Coppermine photo gallery, user passwords can be easily reset using ‘Forgot password’ link in the gallery login page.
The new password generation link would be mailed to the email account corresponding to that user.
But in cases where the email server is not working or someone hacked your account and changed the settings, you may have to reset the password via backend.
Today we’ll see how to reset the administrative password for Coppermine photo gallery from the backend.
1. Identify the database
Coppermine photo gallery stores all the information in database. The first step to reset administrative password is to identify this database name.
The Coppermine configuration file is found in the ‘includes’ folder in the website gallery folder. The file name would be ‘config.inc.php’ and it contains the database details.
Find the database name from the entry corresponding to the ‘dbname’ in the config file. This is the database which contains the table to update the user password.
2. Take a backup of the database
Before making any database updates, it is advisable to take a backup of the database using the ‘mysqladmin’ tool.
This is a precautionary measure to ensure that the gallery can be restored in case a wrong sql query ends up crashing the entire database and the gallery.
3. Update user password in the database
You can access the database either via back-end using ‘mysql’ command or from the front-end using phpMyAdmin.
To update the password via backend, connect to MySQL server. Now select the database using ‘use databasename’ command.
The table ‘CPG_users’ in the database contain the details of the users in the gallery. To update the password, execute the command:
UPDATE `cpg_users` SET `user_password` = MD5( 'new_password' ) WHERE `user_name` = "administrator";
Provide a new strong password for the user ‘administrator’. The username can vary based on the user for which you need to update the password for.
To update the password from phpMyAdmin, go to cPanel -> MySQL Databases -> phpMyAdmin option.
Choose the Coppermine photo gallery database from the left panel. The database tables will be listed underneath. Click on the table ‘cpg_users‘ from that.
The rows in the table ‘cpg_users’ will be displayed on the right panel. From the rows, select the one with the ‘user_name‘ field as ‘administrator’.
Provide the new password in the ‘user_password‘ field corresponding to that user and choose the MD5 encryption. Update the row by clicking on ‘Go’.
Now you would be able to login to Coppermine photo gallery using the new password you have set.
In short..
Today we discussed how to reset the password for Coppermine photo gallery administrator or any user. It is very important to perform all database updates with caution.
Whenever a database name change, username change or database user password update is done, these changes should be updated in the config file too, for the gallery to work.
At Bobcares, we strictly advise setting strong passwords for Coppermine photo gallery users. We also update all vulnerable software to their latest secure versions to avoid hacks.
If you’d like to know how to manage your websites and manage photo galleries with zero downtime, we’d be happy to talk to you.
Wohh just what I was looking for, appreciate it for posting.