MAMP

Database management

Import / export

# Import database from file
/Applications/MAMP/Library/bin/mysql -u [DB_USER] -p [DB_NAME] < data.sql

# Export database to file
/Applications/MAMP/Library/bin/mysqldump -u [DB_USER] -p [DB_NAME] > data.sql

# Log into mysql
# Password: root
/Applications/MAMP/Library/bin/mysql -u root -p

# Run queries
create database learningLaravel;
show databases;

Reference

Assign existing user to imported database

In phpMyAdmin:

  1. Click Home icon.
  2. Click User accounts tab.
  3. Click Edit privileges link for the user.
  4. Click Database tab.
  5. Select the database from the multi-select input.
  6. Check all privileges.
  7. Click Go.

Config

Preferences

  • Apache port: 80
  • Nginx port: 7888
  • MySQL port: 3306
  • PHP version: 5.6.27
  • PHP cache: off
  • Web server: Apache

Apache config

# Edit this file:
# /Applications/MAMP/conf/apache/httpd.conf


# -----------------------------------------------
# Enable GZIP
# -----------------------------------------------

<IfModule mod_deflate.c>
    # Compress HTML, CSS, JavaScript, Text, XML and fonts
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE font/opentype
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml

    # Remove browser bugs (only needed for really old browsers)
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent
</IfModule>


# -----------------------------------------------
# Custom virtual hosts
# -----------------------------------------------

# Add vhosts here

MySQL config

# Edit this file:
# /Applications/MAMP/conf/my.cnf

phpMyAdmin config

Something broke related to the MySQL root user’s password, and this is necessary now:

// File: /Applications/MAMP/bin/phpMyAdmin/config.inc.php

// Leave these alone:
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user']      = 'root';

// Make sure this is 'root':
$cfg['Servers'][$i]['password'] = 'root';

// Add this line:
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = false;

Otherwise you won’t be able to access phpMyAdmin.

PHP config

# Edit this file:
# /Applications/MAMP/bin/php/php5.5.3/conf/php.ini

memory_limit = 128M

Note: you may need to raise to 256M if Magento returns white pages.

Error logs

/Applications/MAMP/logs/apache_error.log
/Applications/MAMP/logs/mysql_error_log.err
/Applications/MAMP/logs/php_error.log

Tricks

  • Disable OPcache if PHP pages don’t refresh. Reference