The topic of recovering root password comes up frequently in the MailingLists.
Here are some answers.
The original (default) RT root user password is "password", not the password you set in RT_SiteConfig.pm (which is your DBMS root user password), nor the password of your Unix root user.
If you over-write or corrupt the root password, there are a few ways to recover it.
Easiest way
Q: I lost the root password how can I reset it?
A: [=mysql> update Users set Password='X03MO1qnZdYdgyfeuILPmQ' where Name='root';]
Resets the root password to "password"
Use another known password
Use SQL to copy the known password from some other user into the root password.
Generate a new password
SQL
Use base64 encoded MD5 of the word 'password'. This should work with all recent RT versions.
mysql> UPDATE Users SET Password='X03MO1qnZdYdgyfeuILPmQ' WHERE Name='root';
With RT-3.4 you can easy set any password for any user.
mysql> UPDATE mysql.user SET Password=MD5('password') WHERE User='root';
Or very old crypt variant.
mysql> UPDATE Users SET Password=ENCRYPT('password','SA') WHERE Name='root';
Perl
Copied from RT-3.0 code:
sub _GeneratePassword {
my $self = shift;
my $password = shift;
my $md5 = Digest::MD5->new();
$md5->add($password);
return ($md5->b64digest);
}
From shell
perl -MDigest::MD5 -e 'print Digest::MD5::md5_base64("password")."\n"'
PHP
In php 5.0.0 or greater only:
$password=substr(base64_encode(md5($password,true)),0,-2);
In php 4.0.0 and others old versions:
preg_replace("/=+$/",'',base64_encode(pack('H*',md5($str))));
nota : function md5(string, boolean) does not exist on version < php 5.0.0, so it is impossible to generate raw_output (raw binary format with a length of 16)
This previous function allows to do it with a php version < 5