Mamp Mysqldump



Follow these steps to move a local, MAMP development environment to a live, production environment (that has shell and WP-CLI enabled; good web hosts do). We will be using command line to achieve this end. The reason to use command line instead of graphical interfaces, like the myriad of available (S)FTP clients or phpMyAdmin, is that command line lends better performance and reliability. Graphical interfaces will time out, or seemingly take forever to load, if your files are large. There is a higher learning curve to command line—it will feel initially like yawping haphazardly into a void—but the reaped time savings make it well worth practicing. Mendeley web importer mac.

Finalize everything in your local development environment (by adding, removing, editing, and updating plugins, themes, WordPress, content) before proceeding.

Mamp mysqldump php

First: Back Up

  1. Local wp-content folder:
    open new Terminal window/tab
    cd [Local WordPress Path] (drag WordPress folder from Finder to Terminal to get path)
    mkdir -p my-wp-backups && tar -czvf wp-content-`date +%F`.tar.gz wp-content -C my-wp-backups
  2. Local wp-config.php file:
    cp wp-config.php my-wp-backups/wp-config-`date +%F`.php
  3. Local MySQL database:
    [Local mysqldump Path] -u [DB_USER] -p --opt [DB_NAME] > wp-database.sql (e.g., /Applications/MAMP/Library/bin/mysqldump) (see local wp-config.php file for DB_USER, DB_NAME, and DB_PASSWORD)
    enter DB_PASSWORD
    tar -czvf wp-database-`date +%F`.sql.tar.gz wp-database.sql -C my-wp-backups
    rm wp-database.sql
  4. Production wp-content folder:
    open new Terminal window/tab
    ssh username@example.com (e.g., ssh adamcap.com@adamcap.com)
    enter password
    cd [Production WordPress Path] (e.g., cd html)
    mkdir -p my-wp-backups && tar -czvf wp-content-`date +%F`.tar.gz wp-content -C my-wp-backups
  5. Production wp-config.php file:
    cp wp-config.php my-wp-backups/wp-config-`date +%F`.php
  6. Production MySQL database:
    wp db export wp-database.sql
    tar -czvf wp-database-`date +%F`.sql.tar.gz wp-database.sql -C my-wp-backups
    rm wp-database.sql

$ mysqldump -user=root -password=root -single-transaction drupal current.sql mysqldump: Couldn't execute 'show table status like 'uc order products pair vw': SELECT command denied to user '@'localhost' for column 'nid' in table 'ucorderproducts' (1143) Last lines from mysql.log: 3 Query use `drupal` 3 Query select @@collationdatabase 3 Query SHOW TRIGGERS LIKE 'uc order line. Nov 30, 2020 Question or issue on macOS: I wonder how I can add mysqldump to my MAMP environment. I googled a bit and found only the community MySQL server version. But I do not want to install another MySQL – basically because I want to save my data first, before any experiment. How to solve this problem? One of the changes in Craft 3 is that, by default, it relies on the mysqldump command to create database backups. That is the most reliable way to dump a database without hitting PHP resource limits like could happen in Craft 2 with large databases. The problem for MAMP users, however, is that its mysql and mysqldump executables are not.

Watch tv on iphone free

Second: Upload wp-content

  1. Gzip local wp-content folder:
    open new Terminal window/tab
    cd [Local WordPress Path] (drag WordPress folder from Finder to Terminal to get path)
    mv wp-content wp-content-new && tar -czvf wp-content-new.tar.gz wp-content-new && mv wp-content-new wp-content
  2. Upload local .tar.gz file to production:
    open new Terminal window/tab
    scp [Local .tar.gz Path] [username@example.com]:[Production WordPress Path] (drag .tar.gz file from Finder to Terminal to get path) (obtain from web host; e.g., adamcap.com@adamcap.com:/var/www/html/ad/adamcap.com)
    enter password
  3. Unzip production .tar.gz file:
    ssh username@example.com (e.g., ssh adamcap.com@adamcap.com)
    enter password
    cd [Production WordPress Path] (e.g., cd html)
    mkdir wp-content-new && tar -xzvf wp-content-new.tar.gz -C wp-content-new --strip-components 1
  4. (Switch production wp-content folder:)
    mv wp-content wp-content-old && mv wp-content-new wp-content
  5. (Revert production wp-content folder:)
    mv wp-content wp-content-new && mv wp-content-old wp-content

Third: Prepare wp-config.php

Mamp
  1. Copy production wp-config.php file:
    open new Terminal window/tab
    ssh username@example.com (e.g., ssh adamcap.com@adamcap.com)
    enter password
    cd [Production WordPress Path] (e.g., cd html)
    cp wp-config.php wp-config-new.php
  2. Edit production wp-config-new.php file:
    nano wp-config-new.php
    Update DB_NAME, DB_USER, and DB_PASSWORD (and verify $table_prefix)
    control + O (to save), control + X (to exit)
  3. (Switch production wp-config.php file:)
    mv wp-config.php wp-config-old.php && mv wp-config-new.php wp-config.php
  4. (Revert production wp-config.php file:)
    mv wp-config.php wp-config-new.php && mv wp-config-old.php wp-config.php

Fourth: Move database

Mysqldump

Mamp Mysqldump Change

  1. Export local MySQL database:
    open new Terminal window/tab
    cd [Local WordPress Path] (drag WordPress folder from Finder to Terminal to get path)
    [Local mysqldump Path] -u [DB_USER] -p[DB_PASSWORD] --opt [DB_NAME] > wp-database-new.sql (e.g., /Applications/MAMP/Library/bin/mysqldump) (see local wp-config.php file for DB_USER, DB_NAME, and DB_PASSWORD)
  2. Gzip local .sql file:
    tar -czvf wp-database-new.sql.tar.gz wp-database-new.sql
  3. Upload local .tar.gz file:
    open new Terminal window/tab
    scp [Local .tar.gz Path] [username@example.com]:[Production WordPress Path] (drag .tar.gz file from Finder to Terminal to get path) (obtain from web host; e.g., adamcap.com@adamcap.com:/var/www/html/ad/adamcap.com)
    enter password
  4. (Delete unneeded/old local files and folders:)
    rm wp-content-new.tar.gz
    rm wp-database-new.sql
    rm wp-database-new.sql.tar.gz
  5. Unzip production .tar.gz file:
    ssh [username@example.com] (e.g., ssh adamcap.com@adamcap.com)
    enter password
    cd [Production WordPress Path] (e.g., cd html)
    tar -xzvf wp-database-new.sql.tar.gz
  6. Switch production wp-content folder:
    mv wp-content wp-content-old && mv wp-content-new wp-content
  7. Switch production wp-config.php file:
    mv wp-config.php wp-config-old.php && mv wp-config-new.php wp-config.php
    (wp config shuffle-salts)
  8. Create new production database:
    wp db drop ; wp db create
  9. Import production .sql file into production database:
    wp db import wp-database-new.sql
  10. Search/replace production database:
    wp search-replace $(wp option get siteurl) [Production Site URL] (e.g., wp search-replace $(wp option get siteurl) https://adamcap.com)
    (wp search-replace [Local Hostname] [Production Hostname])
    (wp search-replace http://[Production Hostname] https://[Production Hostname])
  11. (Revert production wp-content folder:)
    mv wp-content wp-content-new && mv wp-content-old wp-content
  12. (Revert production wp-config.php file:)
    mv wp-config.php wp-config-new.php && mv wp-config-old.php wp-config.php
  13. (Delete unneeded/old production files and folders:)
    rm wp-content-new.tar.gz
    rm wp-database-new.sql
    rm wp-database-new.sql.tar.gz
    rm -rf wp-content-old
    rm wp-config-old.php

Mamp Mysqldump Pro

See Also

Mamp Mysqldump Server

Mysqldump

Mamp Mysqldump Php

  • Move from Live Production Environment to Local macOS Development Sandbox (MAMP) (coming soon)