I am getting an access denied error when trying to connect:

a:4:{i:0;s:92:"SQLSTATE[28000] [1045] Access denied for user 'root'@'' (using password: YES)";i:1;s:2549:"#0 /mnt/host-home/websites/website.co.uk/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()

The MySQL server is on a VirtualBox and I can connect to it using Sequel Pro and also connect while in a shell on the VirtualBox using the exact same details that I have in local.xml.

Can anyone suggest any reasons why the Magento installation is being denied?


  • 1
    Check for any spaces or tabs at the start and the end of the password. Also clear the cache.
    – Marius
    Commented May 8, 2014 at 15:19

1 Answer 1


I worked out what the problem was. The root user on the database didn't have the privileges required when connecting remotely. I remedied the problem by creating a new user (instead of editing root's privileges) specifically for the Magento installation (which is better practice anyway).

For others experiencing the same difficulties and who have root access to their MySQL shell:

Log in to your MySQL shell (replacing values with your own):

mysql -hlocalhost -uroot -proot

In the MySQL shell prompt create a new user:

CREATE USER 'newuser'@'%' IDENTIFIED BY 'thepasswordyouwant';

Then add the privileges:

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%';

Edit your /app/etc/local.xml and change the details to the ones that you used above.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.