Skip to content

Instantly share code, notes, and snippets.

@VincentLoy
Last active December 13, 2018 12:31
Show Gist options
  • Save VincentLoy/c7a3201dfcf63e54391517f233fd29eb to your computer and use it in GitHub Desktop.
Save VincentLoy/c7a3201dfcf63e54391517f233fd29eb to your computer and use it in GitHub Desktop.
# Fix bad default values
sed -i -e "s/0000-00-00 00:00:00/2018-01-01 00:00:00/g" file.sql
sed -i -e "s/OLD_DB_PREFIX/NEW_DB_PREFIX/g" file.sql # if needed
# Update mysql configuration because of dirty DB (/etc/mysql/mysql.conf.d/mysql.cnf in Ubuntu server
[mysqld]
innodb_log_file_size = 512M
innodb_strict_mode = 0
# then drop the original DB if needed, and created it once again
# Import the dump
mysql -h localhost --user wordpress -passwordpass wordpress < backup_2018-12-13-0200_Twog_072d4bdbd043-db.sql
# Go to the WP folder
# Install WP CLI
# Run :
wp search-replace 'OLD_DOMAIN_OR_IP' 'NEW_DOMAIN_OR_IP' --skip-columns=guid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment