Install Drupal with Drush on a Mac with MAMP

Submitted by Peter Majmesku on Thu, 02/08/2018 - 18:16

On MAMP use must specify the "unix_socket" key in your settings.php file databases array, to install Drupal. The quickest way to install Drupal is via a console tool like Drush. Make sure you have copied your default.settings.php file to settings.php. Make sure your databases array looks like so:

$databases['default']['default'] = array (
  
'database' => 'my_database',
  
'username' => 'root',
  
'password' => 'root',
  
'prefix' => '',
  
'host' => 'localhost',
  
'port' => '3306',
  
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  
'driver' => 'mysql',
  
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
); 

Afterwards execute the "drush si" command. See below.

peter@computer my-site $ drush si
You are about to DROP all tables in your 'my_database' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option. [ok]
Installation complete. User name: admin User password: Znf3JkksyW [ok]
Congratulations, you installed Drupal! [status]
peter@computer my-site $