The server in question uses a unique socket for MySQL, and Drupal itself uses mysqli to connect but the php.ini file has mysqli.default_socket and mysql.default_socket both set. I tried switching Drupal to connect via mysql and that also works. This from CLI also works:

mysql -uuser -ppass user_dbname

but when I run drush this is what I see:

$ drush status --uri=http://mysite.com/        
SQLSTATE[00000] [1045] Access denied for user: 'user@localhost' (Using password: YES)  [warning]
 Drupal version         :  6.17                          
 Site URI               :  http://mysite.com/           
 Database driver        :  mysql                         
 Database hostname      :  localhost                     
 Database username      :  user                        
 Database name          :  user_dbname                
 Default theme          :  garland                       
 Administration theme   :  garland                       
 PHP configuration      :  /home/mysite/www/www/php.ini 
 Drush version          :  All-versions-3.0              
 Drush configuration    :                                
 Drupal root            :  /home/mysite/www/www         
 Site path              :  sites/mysite.com 

Everything seems correct to me. I confirmed that my php.ini is being loaded:

$ php --ini
Configuration File (php.ini) Path: .:/etc
Loaded Configuration File:         /home/mysite/www/www/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

But drush can't connect. Is there something that I am not seeing here?

Comments

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

Can you try one of the scripts in Drupal 7 like run-tests.sh or drupal.sh. If you can get one of those working for you, but can't get drush working, then we have a drush bug. For drupal 6, you could test with the run-tests.sh that ships with simpletest module in contrib.

hershel’s picture

Thank for your response. It's a Drupal 6 site. I made a fresh install of Drupal 6 with no changes made whatsoever beyond the initial install. drush dl works so I used that to download simpletest and then I moved the .sh script into /scripts and ran it:

$ php scripts/run-tests.sh Profile
  ERROR: The simpletest module must be enabled before this script can run.

Seems to me that that is enough to indicate that run-tests.sh is actually executing correctly because it would appear that this code was run:

// Bootstrap to perform initial validation or other operations.
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
if (!module_exists('simpletest')) {
  simpletest_script_print_error("The simpletest module must be enabled before this script can run.");
  exit;
}

at line 36. Just to make it 1000% certain I added a few lines of code:

// Bootstrap to perform initial validation or other operations.
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$result = db_query("SELECT name, filename, throttle FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC");
$x =  db_fetch_object($result);
print_r($x);
if (!module_exists('simpletest')) {
  simpletest_script_print_error("The simpletest module must be enabled before this script can run.");
  exit;
}

Here are the results, including drush:

$ php scripts/run-tests.sh Profile
stdClass Object
(
    [name] => block
    [filename] => modules/block/block.module
    [throttle] => 0
)
  ERROR: The simpletest module must be enabled before this script can run.
$ drush st --debug
Found command: core-status (commandfile=core) [0.04 sec, 2.05 MB]                        [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.04 sec, 2.06 MB]               [bootstrap]
Initialized Drupal 6.17 root directory at /home/mysite/www/drush [0.05 sec, 2.57 MB]       [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.05 sec, 2.57 MB]               [bootstrap]
Initialized Drupal site default at sites/default [0.05 sec, 2.57 MB]                        [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.05 sec, 2.57 MB]      [bootstrap]
SQLSTATE[00000] [1045] Access denied for user: 'user@localhost' (Using password: YES) [warning]
[0.06 sec, 2.59 MB]
 Drupal version         :  6.17                            
 Site URI               :  http://default                  
 Database driver        :  mysqli                          
 Database hostname      :  localhost                       
 Database username      :  user                         
 Database name          :  user_drushdrupal             
 Default theme          :  garland                         
 Administration theme   :  garland                         
 PHP configuration      :  /home/mysite/www/drush/php.ini 
 Drush version          :  All-versions-3.0                
 Drush configuration    :                                  
 Drupal root            :  /home/mysite/www/drush         
 Site path              :  sites/default                   
Command dispatch complete [0.06 sec, 2.57 MB]                                               [notice]
 Timer  Cum (sec)  Count  Avg (msec) 
 page   0.007      1      6.98       
Peak memory usage was 2.61 MB [0.06 sec, 2.57 MB]                                           [memory]

Let me know what else I can do to help debug this. Thanks.

jhr’s picture

Component: Interoperability » PM (dl, en, up ...)
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

ticket is almost 2 years old on a version no longer supported