Ask your Symfony questions! Pay money and get answers fast! (more info)

Why do I get "Access denied" from Symfony if the credentials work Symfony

  • SOLVED

We are moving our servers to the Rackspace cloud.

Till now, we've had our sites and out database all live on one server, and we've used "localhost" in our databases.yml and propel.ini files. But now our code will live on one server, and our database will be on a separate server.

If we ssh to our web server and, from there, try to login into MySql, then everything works fine. The username, password and server name all work.

However, our code can not connect to MySql. We have set the correct user, password and server name in databases.yml and propel.ini, and we have cleared the cache.

This is with Symfony 1.2.5.

The error message is something about a Wrapped error, access denied.

We have ruled out the local server - MySql is not installed on it, and the error message is coming from MySql. We are reaching the correct server.

What might cause Symfony/Propel to run into Access denied?

Answers (2)

2010-11-06

Nate Flink answers:

This sounds to me like you haven't enabled remote access to mysql in the my.conf configuration file on the database server, which usually is a matter of changing the bind address line in the config file, and then restarting mysql daemon, assuming it's a linux server, such as ubuntu or some such distro.

This was the first result for googling "howto enable remote access in my.conf" :
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

This is one of those gotchas in multi-server setups, that is not super apparent when moving from a single to multi-server environment.

Also, it sounds like you did this already, but obviously your going to have to make sure the correct ip address for the database server is configured in your databases.yml file.

2010-11-06

Cristian Baciu answers:

Hi,

you should tray to connect from the webserver to the mysql server using plain php.

You could try this script


<?php
$con = mysql_connect("MYSQL_SERVER_HOSTIP","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>


and send us the error message.

If the above script works, you should run "symfony project:permissions" and check once again your spelling in the databases.yml file.

Check (with <?php phpinfo() ?> ) if you have mysql <strong>AND</strong> mysqli extension installed on the web server.
I recommend you to install Zend server CE (http://www.zend.com/en/products/server-ce/index) on your web server.

If you need further assistance pleas let me know.


Kind Regards,
Cristian


Lawrence Krubner comments:

MySql extensions are installed. The spelling of the username and password were checked many times, by 2 people. All Symfony permissions are set correctly.


Cristian Baciu comments:

Can you run my previous script send me the exact error?

Thx,
Cristian