3

I am new to XAMPP and Drush, Mysql doesnt appear in Drush at all. I have no clue what is going on. When I type mysql, I get the mysql command prompt. But when I try drush status command, I dont see mysql in there.

# drush status
 PHP executable         :  php.exe
 PHP configuration      :  C:\xampp\php\php.ini
 PHP OS                 :  WINNT
 Drush script           :      C:\xampp\htdocs\mysite\vendor\drush\drush\drush.php
 Drush version          :  8.0.3
 Drush temp directory   :  C:\Users\USER~1\AppData\Local\Temp
 Drush configuration    :
 Drush alias files      :

I also tried

#drush sql-connect

This returns an error:

Unable to load class Drush\Sql\Sql exception 'Drush\Sql\SqlException' with message 'Unable to find a matching SQL Class. Drush cannot find your database connection details.' in 'drush\commands\sql\sql.drush.inc:588'

Thanks in advance.

lambda8
  • 317
  • 1
  • 4
  • 17

3 Answers3

4

Try adding --root=/full/path/to/your/webroot in your drush command.

I am running into exactly this right now, and this worked for me. I hadn't needed to do it before with drush 6 (?) on the same server but need to now that I've installed drush 8.0.5 via composer.

texas-bronius
  • 558
  • 4
  • 11
2

texas-bronius had the solution for me. On Digital Ocean, after reinstalling Drush from Composer, I had to give the command:

drush up --root=/var/www/html

although just regular drush up had always worked before. I'm not sure why, and it's annoying, but it worked.

1

Drush commands are best run from the root folder of your Drupal installation. For eg. if you have folder structure like this :
ABC
|
-Drupal
|
-XYZ
|
:
:

then run Drush commands from inside the Drupal folder. I guess that should do it.

VivekP
  • 71
  • 1
  • 6