sai kiran anagani tjbk79tarie unsplash 4

I’ve copied my /var/www, MySQL database, and /etc from a sever to an other server.

After this I found that my MySQL does not work anymore.

The reason for the trouble was that /etc/mysql/debian.cnf contains (twice) an auto-generated password for the database, and so after copying my old /etc directory from my old server the password didn’t match the new password stored in my MySQL database.

The solution: Do not overwrite /etc/mysql/debian.cnf file when copying /etc directory, but leave it as it was autogenerated by the new server installation script.

Note: This is a about Debian Linux.