Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'domain'@'localhost' (using password: YES) in /home/domain/public_html/wp-includes/wp-db.php on line 1633

Setup details:

OS: # cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 9 (stretch)" Kernel: Linux domainname 4.19.132-rh162-20200710010734.xenU.x86_64 #1 SMP Fri Jul 10 01:08:37 UTC 2020 x86_64 GNU/Linux Virtualmin ver: 6.11 Webmin: 1.954 mysql/mariadb packages installed:

root@:~# dpkg -l | grep maria ii libmariadbclient18:amd64 10.1.45-0+deb9u1 amd64 MariaDB database client library ii mariadb-client-10.1 10.1.45-0+deb9u1 amd64 MariaDB database client binaries ii mariadb-client-core-10.1 10.1.45-0+deb9u1 amd64 MariaDB database core client binaries ii mariadb-common 10.1.45-0+deb9u1 all MariaDB common metapackage ii mariadb-server 10.1.45-0+deb9u1 all MariaDB database server (metapackage depending on the latest version) ii mariadb-server-10.1 10.1.45-0+deb9u1 amd64 MariaDB database server binaries ii mariadb-server-core-10.1 10.1.45-0+deb9u1 amd64 MariaDB database core server files root@:~# dpkg -l | grep mysql ii default-mysql-client 1.0.2 all MySQL database client binaries (metapackage) ii default-mysql-server 1.0.2 all MySQL database server binaries and system database setup (metapackage) ii libdbd-mysql-perl 4.041-2 amd64 Perl5 database interface to the MariaDB/MySQL database ii mysql-client 5.5.9999+default amd64 MySQL database client binaries [transitional] ii mysql-common 5.8+1.0.2 all MySQL database common files, e.g. /etc/mysql/my.cnf ii mysql-server 5.5.9999+default amd64 MySQL database server binaries and system database setup [transitional] ii php-mysql 1:7.0+49 all MySQL module for PHP [default] ii php7.0-mysql 7.0.33-0+deb9u8 amd64 MySQL module for PHP root@:~#

Fix: login in mysql server and update password. Fix:

  1. Check the pass
  2. Update the pass
  3. Check it again

Notice, the password (hash) stays the same. Weird part of the problem: mysql server shows that the pass is already there.

Important: the website is down at that stage.

root@:~# mysql -u root ..... Server version: 10.1.45-MariaDB-0+deb9u1 Debian 9.12 ..... MariaDB [(none)]> use mysql; Database changed MariaDB [mysql]> select user,password, host from user where user = 'domainname'; +-----------------+-------------------------------------------+-----------+ | user | password | host | +-----------------+-------------------------------------------+-----------+ | domainname | *3D60D22E62F5B0F8[hash]F51889DABBA53BFB | localhost | +-----------------+-------------------------------------------+-----------+ 1 row in set (0.00 sec)

MariaDB [mysql]> SET PASSWORD FOR 'domainname'@'localhost' = PASSWORD('pass'); Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> select user,password, host from user where user = 'domainname'; +-----------------+-------------------------------------------+-----------+ | user | password | host | +-----------------+-------------------------------------------+-----------+ | domainname | *3D60D22E62F5B0F8[hash]F51889DABBA53BFB | localhost | +-----------------+-------------------------------------------+-----------+ 1 row in set (0.00 sec) MariaDB [mysql]>

In that fix I display that the pass for the user is set to "pass". Even though the website is in trouble. Then I set the pass again and get the website up and running.

Any ideas?

Status: 
Active
Files: 

Comments

Was this problem triggered by changing the password for the domain in Virtualmin, or did it never work even directly after the domain was created?

The problem was triggered by creating/deleting additional domain test.com. To summon the error I do: 1. The website works, the pass set, all good... 2. Login into Virtualmin 3. Create top domain server test.com (enable ssl, mysql etc). 4. Once the test.com created, the other website's mysql user looses access to its database as password does not fit any more even though mysql shows that the pass for the website was never changed. The same happens when I delete test.com. It's like server creation/deletion triggers something that breaks another website's password. If I create a top level server without mysql enabled, all goes fine and no websites loose access to db. To fix broken access to the db for the website, I run mysql set password command which refreshes the pass in mysql.user.