I cannot connect to Mysql database nor from PHP scripts nor from PHPMyAdmin however the password is correct. Only changes - MySQL was upgraded to 4.1 or newer version recently.

Created:

2016-11-16 12:48:33 UTC

Modified:

2017-08-08 13:24:00 UTC

0

Was this article helpful?


Have more questions?

Submit a request

I cannot connect to Mysql database nor from PHP scripts nor from PHPMyAdmin however the password is correct. Only changes - MySQL was upgraded to 4.1 or newer version recently.

Applicable to:

  • Plesk for Linux

Symptoms:

Newly created database users works fine, but the old ones that were created before MySQL upgrade cannot connect to it's databases due to password error.

Cause:

Most probably the problem is caused by 'mysqld' using new password notation.

Resolution

Set old_passwords option in /etc/my.cnf in [mysqld] section and restart MySQL:

old_passwords=1

Update passwords for the MySQL users that were created by Plesk in 'mysql' database using the command below:

echo "select dbu.login, a.password from data_bases db, db_users dbu, accounts a where db.id=dbu.db_id and dbu.account_id=a.id" |  MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin -Ns -Dpsa | awk '{print "update user set Password=password(\\x27"$2"\\x27) where User=\\x27"$1"\\x27;"}' |  MYSQL_PWD=`cat /etc/psa/.psa.shadow`  mysql -uadmin -Dmysql
Have more questions? Submit a request
Please sign in to leave a comment.