0

Can we post about Acquia DevDesktop here? i cannot figure out how to log in locally to MySQL using the command line. i posted on their forum and got no response.

Local Acquia DevDesktop sites do not put the DB config info in settings.php. instead it refers to files in an a folder name .acquia which is hidden. on my set up, a typical included looks like this.

Users/myname/.acquia/DevDesktop/DrupalSettings/loc_mywebsite_local.inc

i have managed to open the DB array looks like this.

$databases['default']['default'] = array(
 'driver' => 'mysql',
 'database' => 'mydbname',
 'username' => 'drupaluser',  //this is real default setting for username
 'password' => '',
 'host' => '127.0.0.1',
 'port' => 33067 );

am kind of mystified why there is no DB password?

can any tell me how to access MySQL via the command line. very aggro right now, thanks!

  • Are you able to ssh into the server the DB is running on? – Jance Jun 12 '14 at 20:07
  • @Jance If it's Acquia dev it'll be on the same machine (it's like MAMP) – Clive Jun 12 '14 at 20:07
  • Oh, so it's not like a virtual box then. My mistake, must have been using virtual box for too long. – Jance Jun 12 '14 at 20:10
  • This might help if your on a mac: stackoverflow.com/questions/5131931/… – Jance Jun 12 '14 at 20:15
1

The easiest way to access a CLI database on any site is with drush:

~$ drush help sql-cli
Open a SQL command-line interface using Drupal's credentials.

Examples:
 drush sql-cli                             Open a SQL command-line interface 
                                           using Drupal's credentials.       
 drush sql-cli --extra=-A                  Open a SQL CLI and skip reading   
                                           table information.

Options:
 --database=<key>                          The DB connection key if using  
                                           multiple connections in         
                                           settings.php.                   
 --db-url=<mysql://root:pass@127.0.0.1/db  A Drupal 6 style database URL.  
 >                                                                         
 --extra=<--skip-column-names>             Add custom options to the mysql 
                                           command.

If you don't give it any options, then it will use the normal drush magic to find the settings for the current site you are in or from the site alias that you are using.

$ cd /path/to/your/drupal/docroot
$ drush sql-cli

TL;DR, if you can drush to your site, you can instantly connect to it with drush sql-cli

| improve this answer | |
  • BTW, I think the extra > in the help printout is a minor bug in the help callback, but I am too tired to look at the source right now to check... – mpdonadio Jun 12 '14 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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