You are not logged in or registered. Please login or register to use the full functionality of this board...



Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I change/repair my Admin account if the password got lost?
09-27-2011, 12:52 PM
Post: #1
How can I change/repair my Admin account if the password got lost?
How can I change/repair my Admin account if the password got lost?

Symptoms

If some of the following messages appear:

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

Then you can use the following solutions in order to solve the issue. The example shown below is for RedHat-like operating systems (RedHat, CentOS, FedoraCore). In case of other operating systems, the paths to mysql binaries may differ.

Resolution

First try to restart Parallels Plesk Panel:

# /etc/init.d/psa restart

2. Check that the /etc/psa/.psa.shadow file has valid permissions. The right permissions would be

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

In case you have any other permission, you should change it using the following command:

# chown psaadm:psaadm /etc/psa/.psa.shadow
# chmod 600 /etc/psa/.psa.shadow

3. Check 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 get this output, it means that the Mysql server is already running.

To check that Mysql server is running fine, try to access to the mysql console. For example:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -D psa

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 it will appear the following error message:

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

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

4. Starting from Parallels Plesk Panel version 9.x password can be changed with the utility init_conf
# /usr/local/psa/bin/init_conf --update -passwd newpasswd

SUCCESS: Update of administrator's information complete.


In Parallels Plesk Panel version 8.x, the password can be restored using the "ch_admin_passwd" utility.

# /usr/local/psa/admin/sbin/ch_admin_passwd --help
/usr/local/psa/admin/sbin/ch_admin_passwd: Utility to set Plesk adminstrator's password
Gets password from the environment variable PSA_PASSWORD
Password should be from 5 to 14 symbols and should not contain login name, whitespace, quotes or national characters
Usage: /usr/local/psa/admin/sbin/ch_admin_passwd
-h, --help
display this help and exit

To change the password, use a command like the following one:

# export PSA_PASSWORD='NEW_PASSWORD' ; /usr/local/psa/admin/sbin/ch_admin_passwd; unset PSA_PASSWORD

Where you have to replace NEW_PASSWORD by the desired password for the Parallels Plesk Panel administrator.

If you do not see this utility in the version of your Parallels Plesk Panel, then the password can be synchronized manually.

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

b) Restart MySQL with the following command prompt:

# /etc/init.d/mysqld restart
c) Add the new password to the /etc/psa/.psa.shadow file.

d) Repair the password using the following command prompt:

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

e) Delete skip-grant-tables option from /etc/my.cnf

f) Restart MySQL.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)