Content last modified Monday 6 March 2017
hop to #bottom
About It:
Rate it:
  • Helpful?
  • 5 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

Password reset in MYSQL database

There may be instances in which you or another user on your Textpattern site loses their login password, or you may find that in your webhost’s transition from MYSQL 4.0 to 4.1, your Textpattern password no long works. Apparently the password function in 4.0 creates a 16 character password while 4.1 creates a 40 characters password.

Textpattern passwords are encrypted in the database, so you can’t quite just go in and see/replace the passwords with anything you’d like. But here’s what you can do:

If you have a textpattern install with a password that you’ve forgotten/misplaced/lost the scrap of paper you wrote it down on, you can edit one of the users via mysql and change the password field to:


Then log in with the password:

(that’s a zero, not an OH)

The other way to do it is to run the following query in phpMyAdmin:

UPDATE txp_users SET pass = PASSWORD('newpass') WHERE name = 'loginName';


UPDATE PFXtxp_users SET pass = password('NEW_PASSWORD') WHERE user_id = 'USER_ID_OF_USER'

where PFX is the prefix you set in your TXP config (make sure you wrap the whole thing in backticks, though not doing so probably won’t have an effect), NEW_PASSWORD is the new password you want, wrapped in single quotes. USER_ID_OF_USER is the user_id of the user whose password you want to reset.

Thanks to “Ray”: ryanschwartz and greenrift for these answers.

Marcus Geiger has written instructions in German.

Article Request Count:
Posted here:
27 Feb 2005
Article modified:
02 Nov 2006

You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:

Commenting is closed for this article.

Commented (10)

phew, that worked. i was moving an install from my old hosting people to textdrive and when i did, i couldn’t login any more. setting the password to ‘Passw0rd’ didn’t work for me but the sql did. thanks.
When RC4 was released Sencer expressed the interest to move away from mysql’s password function. So this might no work forever.

Also the password you set has to be all lowercase as discussed in this thread which also contains steps for doing this with phpMyadmin
hm.. so admin password reset would have to be built into the login screen. well, that will be very happiness when it happens.
Thank you for this valuable there is no forget passworld link in the admin login area. I think that is a must.

Thanks a lot… after a long 2 hours trying…

thanks for the helpful tip! the database hash didn’t work, but the “UPDATE txp_users” tip worked well. I didn’t know you could hash a password like that in SQL!

Since doing this, I’ve been getting the following Error:

Notice: Undefined index: view in [path to file]/textpattern/lib/txplib_misc.php(570) : eval()‘d code on line 24



Relieved to find that the ‘UPDATE txp_users SET pass = PASSWORD WHERE name = ‘loginName’; ‘ method worked a treat in v.4.2.0


Using pre installed tp on Worked great, just had to alter it to:

‘UPDATE textp_txp_users SET pass = PASSWORD WHERE name = ‘loginName’; ‘


Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

Would you care to write a comment or visit the forum discussion?

You know you want to visit the Archives.




There are also tag clouds, 'cause those are fun.
Published with Textpattern