I have installed mysqlnd when I try to use the drush command drush cc all, I get the following message.

No Drupal site found, only 'drush' cache was cleared.

and when I run the command drush ws I get the following message.

PHP Fatal error: Call to undefined function module_exists() in phar:///usr/local/bin/drush/commands/core/drupal/environment_7.inc on line 187 Drush command terminated abnormally due to an unrecoverable error.
Error: Call to undefined function module_exists() in phar:///usr/local/bin/drush/commands/core/drupal/environment_7.inc, line 187

If I try to run the above commands without the mysqlnd plugin, they work fine.

Also, if I run drush status I get the following:

 Drupal version         :  7.43                             
 Site URI               :  http://default                   
 Database driver        :  mysql                            
 Database hostname      :  myapp                            
 Database port          :                                   
 Database username      :  drupal                           
 Database name          :  web1                             
 PHP configuration      :  /etc/php.ini                     
 PHP OS                 :  Linux                            
 Drush script           :  /usr/local/bin/drush             
 Drush version          :  8.1.3                            
 Drush temp directory   :  /tmp                             
 Drush configuration    :                                   
 Drush alias files      :  /root/.drush/aliases.drushrc.php 
 Drupal root            :  /var/www/html/site2              
 Drupal Settings File   :  sites/default/settings.php       
 Site path              :  sites/default 

The above won't show the theme name. Also if I try to run drush mysql-cli I get the following message:

ERROR 2005 (HY000): Unknown MySQL server host 'myapp' (0)

I wonder if I can get the above commands running using the mysqlnd plugin.


2 Answers 2


The solution was adding the following code in settings.php. It will allow Drush to connect to mysqlnd.

if (drupal_is_cli() || basename($_SERVER['PHP_SELF']) == 'update.php') {
  $databases['default']['default'] = $databases['default']['ms'];

The solution is adding the following path to system environment.

It is because of mysql.exe it not found globally.


The PATH environment variable should be assigned by going to My Computer > Right-click any blank area inside window > Properties > Advanced tab > Environment Variables > System Variables > select PATH & edit as described.

Your Answer

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

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