After someone messed up the server, Magento could not connect MySql DB.
First try, I used mysql -u <username> -h localhost -p
and failed to authenticate.
After a lot of struggle this guy helped me (the solution is in the comments), so I finally succeeded connecting to the DB using Magento's credentials. But then I couldn't connect remotely, this one didn't help since --skip-networking
disables remote connection, but I finally figured it out as well (now I don't remember what I did, either changed something in my.cnf
or /etc/hosts
).
So now I can connect with Magento username/password (configured in configuration.php
) both locally and remotely.
Still, Magento prints to screen errors that it can't connect MySql.
I checked both local.xml
and config.xml
(under <Magento root>/app/etc
) and both seems to be configured correctly.
I started thinking about installing the whole thing from scratch, the problem is that there isn't any good backup and I'm not sure what/if I'm going to loose data by doing that, but if I'll have to, I'll backup the files+DB and go for it...
Any ideas ?
UPDATE
After endless digging, apparently there were other XML files in the same directory with local.xml and config.xml. Removing these files (which were created as backups, but were left with the .xml extension) the problem was solved.
Conclusion: if you backup xml files, save the backup as file.xml.backup
so it won't be treated the same as a file with an xml extension!