How to set mysql port for Drupal and Drush My site was running fine with the following default setting in settings.php file:

'host' =&gt; 'localhost',
'port' =&gt; ''


Then I created a separate mysql instance on another port:

'host' =&gt; 'localhost',
'port' =&gt; '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' =&gt; 'localhost:123',
'port' =&gt; ''
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' =&gt; array('default' =&gt; array(
  'driver' =&gt; 'mysql',
  'database' =&gt; 'yourdb',
  'username' =&gt; 'mysqluser',
  'password' =&gt; 'mysqlpassword',
  'host' =&gt; 'dbhost',
  'port' =&gt; 33066 )));