Upgrading Drupal modules using Drush

This is one of the many benefits of using drush when working with Drupal. I opened up a project that I was working on locally and had the warning that some of my modules required an upgrade, not only that Drupal core had gone from 6.19 to 6.20.

Now, normally this used to mean I had to go off and download the latest Drupal core and all the other modules, backup all my site and database and install all the updates manually. By using Drush a lot of this pain goes away. Although I recommend backing up your site and database before any update.

Firstly, you need to setup Drush, which you can see how to in my last post Setting up Drush on MAMP and then open up Terminal and get into your modules directory.

cd ~/Sites/71SQUARED/htdocs/sites/default/modules

Depending what project or where your project is located, the above line will be different.

Then, issue the command

drush up

What drush will do then is go through all your modules and check if there are updates available, if there is it will ask you whether you want to upgrade (y/n) once you type “y” it will do all the work for you and let you know of any errors along the way. How easy is that :)

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

6 Comments

martinmenge  on January 15th, 2011

Thanks for the excellent tut. I do however keep getting an error.

“Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This error often occurs when Drush is trying to bootstrap a site that has not been installed or does not have a configured database.”

I presume this has something to do with not getting the right access on mysql, but I have no idea how to proceed.

John  on January 15th, 2011

Hi Martin,

Are you using ‘localhost’ in your db connection or ’127.0.0.1′?

If it is localhost, try changing it to ’127.0.0.1′

If not, then could you send me the rest of the error i.e:

Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This error often occurs when Drush is trying to bootstrap a
site that has not been installed or does not have a configured
database.

Drush was attempting to connect to :
Drupal version : 6.16
Site URI : http://default
Database driver : mysqli
Database hostname : localhost
Database username : correct username
Database name : correct db name
Default theme : garland
Administration theme: garland
PHP configuration : /usr/local/lib/php.ini
Drush version : 3.3
Drush configuration:
Drupal root : /home/user/public_html/netsperience
Site path : sites/default
Modules path : sites/all/modules
Themes path : sites/all/themes
%paths : Array

martinmenge  on January 15th, 2011

Hi John,

I kept getting locked out when changing the db from localhost to 127.0.0.1
So I changed the .cnf file http://drupal.org/node/502252#comment-3356018
I still get this error message though:

ommand pm-enable needs a higher bootstrap level to run – you will [error]
need invoke drush from a more functional Drupal environment to run
this command.
The drush command ‘enable update’ could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This error often occurs when Drush is trying to bootstrap a
site that has not been installed or does not have a configured
database.

Drush was attempting to connect to :
Drupal version : 6.17
Site URI : http://htdocs
Database driver : mysqli
Database hostname : localhost
Database username : u/n
Database name : db
Default theme : garland
Administration theme: garland
PHP configuration : /Applications/xampp/etc/php.ini
Drush version : 4.1
Drush configuration:
Drush alias files :
Drupal root : /Applications/MAMP/htdocs/happyangellight
Site path : sites/default
Modules path : sites/all/modules
Themes path : sites/all/themes
%paths : Array

You can select another site with a working database setup by
specifying the URI to use with the –uri parameter on the command
line or $options['uri'] in your drushrc.php file.

[end error]

What is of particular interest here is xampp ini. How and where do I change this?

John  on January 15th, 2011

What folder are you running drush up in?

“ommand pm-enable needs a higher bootstrap level to run – you will [error]”

This error normally means you need to run drush up from the root level.

martinmenge  on January 16th, 2011

my MAMP installation had socket issues. An uninstall of MAMP followed by a frantic Time Machine restore of ./htdocs and a reinstall of MAMP worked fantastically. Thanks for the help

Snaky  on January 20th, 2011

update is nice – but how do you rollback on errors? You should not update, if you are not prepared to rollback!

Leave a Comment