I have *cough* never forgotten my password to anything because I followed Brian’s excellent advice about storing passwords, but just in case some of you have, I thought I’d help you out.
First off, if you are locked out of your MODx manager, you can use the standard link on the manager page to email you your password, but I’m outlining how to do this in the event that you either didn’t enter a valid email address or you aren’t receiving your emails somehow. There are two things I’m going to outline:
Resetting your MODx manager password
Adding a new MODx manager user
WARNING: Both options require that you have read/write access to the MySQL database where the MODx information is installed. PROCEED WITH CAUTION… THIS REQUIRES DATABASE EDITS.
Option 1 is nicely outlined by this article at Lucid Green: How to get into MODx when your blocked or lost your password. The article is a bit dated (2006), but it’s still valid… to summarize, do the following:
Resetting Your MODx Manager Password
We’re going to do two things here: change your password, and clear any blocks on your manager user.
Login to your site’s database (e.g. using phpMyAdmin).
Find the table modx_manager_users –in phpMyAdmin, find the table in the list on the left.
NOTE: the modx_ is the default table prefix… your installation may use a different prefix, or it may use no prefix. If you honestly can’t locate the table, you may have to resort to the following query to find the table: SHOW TABLES LIKE '%manager_users';
Type that at the MySQL prompt and any tables with a name ending in “manager_users” will be shown.
Select your user from the list — in phpMyAdmin you can click the “Browse” tab to browse the rows in each table. Choose to CHANGE or EDIT the row.
Select the MD5 function to operate on the password column. In phpMyAdmin, when you edit a record, you can use functions to operate on each column. Once you’ve selected to use the MD5 function, you can type your new password normally.
If you are doing this via the MySQL command line, the actual query we execute looks something like this: UPDATE `your_db`.`modx_manager_users` SET `password` = MD5( 'changeme' ) WHERE `modx_manager_users`.`id` =1 LIMIT 1 ;
NOTE: if you execute this query at the command line, you must type apostrophes to delineate your password (they will not be included as part of the password). If you are doing this via phpMyAdmin, do NOT type the apostrophes.
Save the changes to the row.
Please note the id for the row that you just edited… you may need it.
Go to the modx_user_attributes table and find your manager user and edit this row (here’s where it’s handy to have that id from the above steps.
Change only the following items then save the row: * Set “blockeduntil” to zero (0). * Set failedlogincount to zero (0).
On the MySQL command line, your query looks something like this: UPDATE `your_db`.`modx_user_attributes` SET `blockeduntil` = '0',`failedlogincount` = '0' WHERE `modx_user_attributes`.`id` =1 LIMIT 1 ;
You should now be done… head over to yourdomain.com/manager and login using your new password.
Adding a New MODx Manager User
This is a bit more devious, but the commands aren’t much different than the above, except that we are INSERTING rows into 2 tables instead of UPDATING them. There are many times I’ve needed to “let myself in” using this technique…
As above, login to your site’s database (e.g. using phpMyAdmin).
As above, find the table modx_manager_users –in phpMyAdmin, find the table in the list on the left. (If you have trouble finding the table, see the tip in step #2 above).
Instead of updating an existing record, we are going to create one — in phpMyAdmin, click the “INSERT” tab. Be sure that you do the following: * type a valid username (usually, this is one word, lowercase) * type a valid password (use the MD5 function!) * Leave the id field blank (it will auto-increment). * Select “MD5” as the function for the password field (don’t forget!) * Leave the “Ignore” box checked — phpMyAdmin allows you to insert a couple rows at once, but we only need to insert one.
Then click Go to insert the new record.
The actual MySQL query used here is something like this: INSERT INTO `your_db`.`modx_manager_users` (
'everett', MD5( 'changeme' )
Remember the id of the newly inserted user! You’ll need it — phpMyAdmin shows it after the row was inserted. If you misplaced it, you can simply browse the table and find your user — remember the id!
Go to the modx_user_attributes table and insert a new row: Add the following values: * id LEAVE BLANK. It will auto-increment. * internalKey should also be equal to the your user id from step 4. * role = 1 (for manager users)
The actual query looks something like this: INSERT INTO `your_db`.`modx_user_attributes` (`internalKey` ,
That’s it. You should now be able to use that username and password to login into your MODx manager at www.yourdomain.com/manager