0

I'm trying to get drush working on my ubuntu laptop because I want to try out the omega theme in Drupal, but some commands just don't work.

For example: drush en omega or drush omega-wizard

The Error I get: Drush was not able to start (bootstrap) the Drupal database. or Command pm-enable needs a higher bootstrap level to run - you will [error] need to invoke drush from a more functional Drupal environment to run this command.

I've read in other threads, that this has something to do with drush not being able to connect to my mysql database and that I should change 'localhost' to '127.0.0.1' in my settings.php.

I am using XAMPP and drush v 7.0-dev on my ubuntu 14.04.

I've also tried setting drush up on my windows 8.1 machine with xampp and ran into the same error.

Please help me, I ve been trying the whole weekend to set drush up and I am getting really desperate :(

The full error msg for 'omega-wizard'

The drush command 'omega-wizard' could not be found. Run drush [error] cache-clear drush to clear the commandfile cache if you have installed new extensions. Drush was not able to start (bootstrap) the Drupal database. [error] Hint: This may occur when Drush is trying to: * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See drush topic docs-aliases for details. * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

Drush was attempting to connect to: Drupal version : 7.31
Site URI : http:// default
Database driver : mysql
Database hostname : localhost
Database port :
Database username : root
Database name : drupal1
PHP executable : /usr/bin/php
PHP configuration : /etc/php5/cli/php.ini
PHP OS : Linux
Drush version : 7.0-dev
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
Drupal root : /home/trautmann/websites/mywebsite Site path : sites/default

mtthias
  • 177
  • 3
  • 16
  • You may have more luck over at http://drupal.stackexchange.com/ since this isn't about programmer per se... – Wooble Aug 12 '14 at 12:44

4 Answers4

3

Wohoo I found a solution!

Thanks to Nathan I followed the error 'sh: 1: mysql: not found' provided by drush sql-cli and found this:

http://www.webbykat.com/2012/06/solving-sh-mysql-command-not-found-mamp-pro-2 which says, that my mysql command might not be mapped to the right location.

I adapted the solution for xampp by putting this line into my .bash_profile

export PATH=$PATH:/opt/lampp/bin

and boom! it worked :)

thanks again nathan

Edit: Also, I found that drush needs to use the php executable in your xampp folder, you can set your PHP-path in your .bash_profile with

export DRUSH_PHP=/opt/lampp/bin/php
mtthias
  • 177
  • 3
  • 16
0

To see if drush is connecting to your site, you should go to the site's root directory for a single site install or to the site specific directory for a multisite install, then run "drush st" to see if your site is configured, this is what I get:

NY-MC-NB-NANDERSEN:muscleandfitness.com nandersen$ drush st

Drupal version : 7.31
Site URI : http://muscleandfitness.com
Default theme : garland
Administration theme : garland
PHP configuration : /Applications/MAMP/bin/php/php5.4.10/conf/php.ini Drush version : 5.9
Drush configuration :
Drupal root : /Users/nandersen/dev/drupal7-core/docroot
Site path : sites/muscleandfitness.com
File directory path : sites/muscleandfitness.com/files

I'm running this from

/Users/nandersen/dev/drupal7-core/docroot/sites/muscleandfitness.com

on a multisite install

From what I'm seeing above, it looks like your drush isn't finding your site and connecting properly.

For example, if I'm not in the correct directory, I get this when I run "drush st"

NY-MC-NB-NANDERSEN:docroot nandersen$ drush st Drupal version : 7.31
Default theme : garland
Administration theme : garland
PHP configuration : /Applications/MAMP/bin/php/php5.4.10/conf/php.ini Drush version : 5.9
Drush configuration :
Drupal root : /Users/nandersen/dev/drupal7-core/docroot

To test if you are connected to the database, you can run the command "drush sql-cli" which will launch into the currently bootstrapped database.

To see if a command is available, such as "omega-wizard", you can just type "drush" then pipe it to grep then the search term, so "drush | grep wizard", this will output any command that has wizard in the help file. If I forget commands, this is how I see what drush commands are available. Since you can't enable omega, and the omega command aren't available, this is another sign that you probably are not connecting to the database properly.

oknate
  • 1,068
  • 10
  • 14
  • Hallo, thanks for the fast help :) When I do 'drush st', I get the same list as in my first post. When I do 'drush sql-cli', I get 'sh: 1: mysql: not found'. I can find the omega command via grep but when I try 'drush cc all', it tells me that no drupal installation was found. – mtthias Aug 13 '14 at 09:29
  • what's the local domain name and root directory? Are you running command from the root directory? – oknate Aug 13 '14 at 16:42
0

For the Windows environment running XAMPP, I added C:\xampp\mysql\bin\ to the PATH environment variable so that mysql.exe can be found.

0

Turn on debug message when issuing drush command will give out more information about what is not working. In case of not be able to run mysql, the -d option will report that so you know the direction to fix the problem.

drush -d omega-wizard

...

Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.1 [bootstrap] sec, 4.48 MB]

sql-query: SELECT 1; [0.16 sec, 4.6 MB]

Executing: mysql --defaults-extra-file=/private/tmp/drush_aATUxP --database=drupal --host=localhost --silent < /private/tmp/drush_JBBjco

sh: mysql: command not found

hko19
  • 1,054
  • 4
  • 16
  • 25