PDA

View Full Version : How-To repair my admin account if the password is lost?


eWebtricity
01-10-2006, 01:11 PM
Product versions this article applies to:
Plesk for UNIX (questions are not related to version) The latest update: Oct,27 2005
Access: public Article ID #346

If you see one of the following error messages:

1. Unable to connect to database
2. login.php3: Unable to connect to database: Permission denied
3. ERROR 1045: Access denied for user: 'admin@localhost' (Using password: YES)


Then we can offer you the following options to solve this issue.

1. Please try to restart Plesk first:


# /etc/init.d/psa restart

2. Make sure that "/etc/psa/.psa.shadow" file has a valid permissions. Right permissions should be

# ls -la /etc/psa/.psa.shadow

-rw------- 1 psaadm psaadm 5 Feb 26 11:22 /etc/psa/.psa.shadow

If you have any other permissions, then you need to change it using the following command: # chown psaadm:psaadm /etc/psa/.psa.shadow
# chmod 600 /etc/psa/.psa.shadow

3. Make sure that Mysql server is running and working properly using the "ps ax | grep mysql" command.

For example:


# ps ax | grep mysql

7996 ? S 0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf
8022 ? S 0:14 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr
--datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking

If you see this output, then it means that Mysql server is running.

To check that Mysql server is working properly, you should try to log into mysql console.

For example:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1299 to server version: 3.23.54

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.mysql>


Usually the error message presented below appears:

ERROR 1045: Access denied for user: 'admin@localhost' (Using password: YES)

If you cannot log into MySQL using command line above, then the following solution will help you to repair admin account password.

4. You can synchronize password that is usually saved in /etc/psa/.psa.shadow file with MySQL password.

a) Load MySQL with the 'skip-grant-tables' option by adding skip-grant-tables into [mysqld] section of the /etc/my.cnf file

b) Restart MySQL with the command line below:

# /etc/init.d/mysqld restart

c) Repair password with the command line below:

# /usr/bin/mysql -D mysql -e"update user set password=PASSWORD('`cat /etc/psa/.psa.shadow`') where User='admin';"

d) Remove skip-grant-tables option from /etc/my.cnf

e) Restart MySQL.

------------------------------
Source: http://faq.sw-soft.com/article_16_346_en.html
Submitted By: Forza