Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-12-23 14:23:18

craigbass76
Member
Registered: 2009-12-23
Posts: 36

Reset Password

I tried setting up a new user last night. While trying to figure out how to set their password, I just said “FAH!” and tried to delete them. They wouldn’t go away.

So I went into the database itself and did a “delete from users where ID = ‘2’;

Unfortunately, I think #2 was me; I couldn’t login as admin, though admin is still in the database. I tried an

update users set user_pass = ‘md5encryptedstring’ where ID = ‘1’;

but that didn’t work. I also tried something I read about here. Some mysql password command that even in ’05-‘06 folks were saying probably wouldn’t work for much longer.

I have total access to the server (it’s my laptop) and the mysql command line. How do I either get in and reset the password, or set up a new admin user without using the text pattern UI ?

Offline

#2 2009-12-23 14:37:29

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,376
Website GitHub Mastodon

Re: Reset Password

INSERT INTO txp_users (
name,
pass,
RealName,
email,
privs
)
VALUES (
'superman', 
PASSWORD( 'password' ) , 
'Clark Kent', 
'me@example.com', 
'1'
)

Offline

#3 2009-12-23 15:24:16

craigbass76
Member
Registered: 2009-12-23
Posts: 36

Re: Reset Password

Awesome. what’s privs of 0 mean? Can’t log in? The admin user is still in there but has 0; perhaps that’s why I can’t log in with that? Is the password supposed to be plain text, or an md5 string?

Offline

#4 2009-12-23 19:34:05

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Reset Password

0 = no privileges
The password is stored using the mysql PASSWORD function, which (IIRC) is not the same as MD5 and definitely not plain text ;)

Offline

#5 2009-12-24 02:38:05

craigbass76
Member
Registered: 2009-12-23
Posts: 36

Re: Reset Password

My table is different. These are the columns of my users table.

ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name

A query:

INSERT INTO users VALUES (‘2’, ‘me’, PASSWORD, ‘Me’, ‘me@example.com’, ‘ ‘, NOW, ‘ ‘,‘1’, ‘Me’);

works (the data is in there) but I can’t log in yet.

Last edited by craigbass76 (2009-12-24 02:44:23)

Offline

#6 2009-12-24 04:17:02

Siguo
Member
From: Beijing, China
Registered: 2008-05-22
Posts: 44

Re: Reset Password

hi, craig, you can install a txp copy in you local pc with user admin, then replace the server database user_pass field with the new value.

or you can use this:

update users set user_pass = password(lower(‘password’)) where ID = 1;

Last edited by Siguo (2009-12-24 04:25:23)

Offline

#7 2009-12-24 12:21:44

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Reset Password

Does Textbook help?

Offline

#8 2009-12-24 14:56:35

craigbass76
Member
Registered: 2009-12-23
Posts: 36

Re: Reset Password

When I set up a second instance of txp, I can see that my table is the same as what you say. Why is the one I messed up different? I didn’t change any structure manually, just deleted a user.

Offline

#9 2009-12-24 20:24:09

craigbass76
Member
Registered: 2009-12-23
Posts: 36

Re: Reset Password

This is still not working. I even tried dropping the user table and creating a new one based on a dump from a good database.

Perhaps I’d be better off dumping data from this screwy dbase into the new one. I really didn’t want to have to recreate everything from scratch. What needs to go?

Offline

#10 2009-12-24 20:51:31

craigbass76
Member
Registered: 2009-12-23
Posts: 36

Re: Reset Password

AHHHHH! Forget it. All fixed. Wrong db. I can give my home address if anyone would like to come beat me. After New Years.

I can’t believe I’m so dumb…. I found the error when I looked in config.php.

Offline

#11 2009-12-25 17:51:46

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Reset Password

Craig, if januari 4th is okay, then send me your address ;)

Offline

#12 2009-12-25 19:47:10

craigbass76
Member
Registered: 2009-12-23
Posts: 36

Re: Reset Password

I had a few db’s on this box. One was called best. The other was called best2. A php site I wrote myself was using best as a backend. Txp was using best2. They both had the same two users.

What really happened was that I created the second user in best2, then tried to log in (as craig) to txp. I had a different password, couldn’t log in, got mad, went into best and kept changing the password. As I said, wrong db.

All of the variations on the command people were posting here would have worked fine, and did finally when I noticed the correct db name in config.php.

I’m back to one database now. It’s named appropriately, and I have been able to have a merry Christmas as a result.

Offline

Board footer

Powered by FluxBB