Last active
November 23, 2015 10:17
-
-
Save dbushell/403bd7bdf3072392ba86 to your computer and use it in GitHub Desktop.
WordPress local development (MAMP)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Easy steps for cloning a live WordPress site for local development with MAMP. Am I missing anything? | |
1. add new MAMP server | |
2. download all files | |
3. export MySQL database | |
4. import SQL to MAMP via command line: | |
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -p dbname < ~/Downloads/database.sql | |
5. update: wp-config.php | |
define('DB_NAME', 'dbname'); | |
define('DB_USER', 'root'); | |
define('DB_PASSWORD', '[PASSWORD]'); | |
define('DB_HOST', 'localhost'); | |
define('WP_SITEURL', 'http://localhost.dev'); | |
define('WP_HOME','http://localhost.dev'); | |
6. done? |
Like @tobaco I also do a search-and-replace on the database to make sure all URLs in the database are properly updated. I prefer to use wp-cli
though, instead of a wp plugin.
That being said, wp-cli offers quite a few more helpful tools, e.g. wp db import
will automatically take the connection data from the wp-config.php
to import the SQL file, making step 4 a bit easier.
@mkleucker it's not a plugin. it's a standalone script with some nice features like „dry run“ (preview of what will be replaced and where)
@tobaco Ouch, sorry. I confused it with https://wordpress.org/plugins/better-search-replace/ just by the title.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
4.1 Search and replace server domain with local. Use: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
5.1 Set up multi environment. Use: https://github.com/studio24/wordpress-multi-env-config