-
-
Save dbushell/403bd7bdf3072392ba86 to your computer and use it in GitHub Desktop.
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? |
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
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.
Maybe add these to your config for dev?