Liferay: how to reset user password in database (use in dev dev only!)

Warnings

Don’t do this in production environments! Following this procedure will store passwords in clear text in your database!

It can be useful if you want to reset default admin user password, or somebody’s password in a test environment.

Procedure

Find the user id of the user you want to reset his password. Pretty easy to find in database (hint: table User_ 😉 )

  • Stop Liferay
  • Execute this query
UPDATE 
	User_
SET 
	password_ = '<PASSWORD_IN_CLEAR_TEXT>',
    passwordEncrypted = 0
WHERE 
	userId = <USER_ID>
;
  • Start Liferay
  • Login with new password! It’s working fine 🙂

Did I say that you should not do it in production environments? 😉

One thought on “Liferay: how to reset user password in database (use in dev dev only!)

  1. Let me also give u a small tip to give role to a user in DB:

    insert into Users_Roles (userId,roleId) values (10143,11703);

    where 10143 is userid of the user and 11703 is the roleid.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s