uploaded an existing drupal codebase to a virtual host set up on AWS. it is showing "can not connect to database"
I created database "dbname" and can connect fine through ssh. But can not get settings.php to connect. As far as I can tell the mysql user has all needed permissions to access the db remotely.
what I have
$db_url = 'mysql://username:password@us-west-rds.amazonaws.com/dbname';
Here is example of settings.php with a drupal 7 site of ours that connects fine
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'dbname',
'username' => 'dbuser',
'password' => 'password',
'host' => 'us-west-rds.amazonaws.com',
'port' => '3306',
'driver' => 'mysql',
'prefix' => '',
),
),
);
There are several things to check:
The easiest way to debug this is to use the console mysql
command and try to connect to your instance from there:
mysql dbname -u username -p password -h db01b2.ck1dmcn6kfws.us-west-1.rds.amazonaws.com
If this does not work, check the points given above. If this works and does not work in Drupal only, check your PHP code and/or Drupal config.