Magento – Mysql access denied error

databaseerrorMySQL

I have a common problem but the usual solutions are not working so apologies for what on first appearance may seem like a previously asked question.

I have the following error when trying to view my site on my local

    Access denied for user 'sitename'@'localhost' (using password: YES)

The credentials being used wrong but I don't know where they are coming from.
I have checked app/etc/local.xml and it has all correct credentials.
I have removed all other xml files from the directory (except config.xml).
I have deleted the contents of the var folder (numerous times)

I have other magento sites working on my local so my server settings should be fine. I'm really stumped on this and don't know what next step I should take. Any help would be appreciated.

Best Answer

You need to make the user sitename@localhost able to access the database and tables in question. Use the following SQL as a root or superuser on the MySQL instance to grant the privileges:

GRANT ALL ON magento_local.* TO 'sitename'@'localhost';

For more information on Grants in MYSQL see the manual: http://dev.mysql.com/doc/refman/5.1/en/grant.html

Related Topic