1

My site was running fine with the following default setting in settings.php file:

'host' => 'localhost',
'port' => ''

Then I created a separate mysql instance on another port:

'host' => 'localhost',
'port' => '123'

But this does not affect drupal - it still connects to the old db on default port!

With the following settings drupal connects to the new db, but now I can`t make archive-dumps with drush. Drush reports an "Unknown MYSQL server host error".

'host' => 'localhost:123',
'port' => ''

1 Answer 1

1

For the port configuration in settings.php you can do by following(in example i used MYSQL in 33066) and the value of port is integer not string:

//D6 DB config
$db_url = 'mysqli://mysqluser:mysqlpassword@dbhost:33066/yourdb';

//D7 DB config
$databases = array('default' => array('default' => array(
  'driver' => 'mysql',
  'database' => 'yourdb',
  'username' => 'mysqluser',
  'password' => 'mysqlpassword',
  'host' => 'dbhost',
  'port' => 33066 )));
3
  • That is what I tried. > But this does not affect drupal - it still connects to the old db on default port!
    – Olaf
    Dec 4, 2013 at 10:55
  • Drush only get configuration from /sites/default/settings.php. Did you place your settings file in /sites/yoursite.abc/settings.php?
    – Stone Vo
    Dec 5, 2013 at 3:03
  • Drush is using /sites/yoursite.abc/settings.php, at least for archive-dump command, where I tell it which site to archive. And yes, I am changing only mysite/settings.php. With 'localhost' it is working, with 'localhost:portnum' - not.
    – Olaf
    Dec 5, 2013 at 4:41

Your Answer

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

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