Question: How do you force Drush to use all of the PDO options specified in a site's settings.php file?
Background: I am using Drupal 7.22 with Apache and the Drupal files (and Drush 5.8.0) on one physical server, and MySQL on another physical server. I have specified extended PDO options within the settings.php file in order to connect to the MySQL DB using SSL. The website itself works great, and Drupal can connect and use the DB without error. However, Drush does not establish a connection to the DB, and I receive (using -dv on Drush) the following error:
SQLSTATE[28000] [1045] Access denied for user
'drupal'@'192.168.0.38' (using password: YES)
With the user and host being the proper user and host for the MySQL user. If I disable the SSL requirement of the DB user within MySQL, Drush connects fine. This is not an option however, as security is of importance.
I have also checked the CLI vs. the CGI .ini files, and also ensured the PDO extension was available to both.
The database lines from settings.php:
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'drupal',
'username' => 'drupal',
'password' => 'password',
'host' => '192.168.0.39',
'port' => '3306',
'driver' => 'mysql',
'prefix' => '',
'pdo' => array(
PDO::MYSQL_ATTR_SSL_KEY => '/home/drupal/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT => '/home/drupal/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA => '/home/drupal/ca-cert.pem',
),
),
),
);
The user, password, db, ip, and file paths have been changed from the actual, but are similar in nature.
-ssh-options
from either here or a blog I read and this issue queue item drupal.org/node/820514. But, it seems odd that Drupal would respect the addtional parameters you supply by default and not drush. You might want to play with-ssh-options
and the drush command line/config file.