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'@'192.168.100.102' (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?
Thanks
Best Answer
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.