You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What would you think of a simple script like this one?
Wouldn't it be easier or am I being too simplistic using sed?
$SITE_B_DB, $SITE_B_USER, PREFIX1, PREFIX2, SITE_B would need to be replaced in the script.
wp --allow-root db export /tmp/export1.sql # Export DB
sudo sed "s/$PREFIX1/PREFIX2/g" /tmp/export1.sql > export2.sql # Replace prefix (make sure it is random like "ds5K6g" so no issue with DB content)
mysql -u root -p'"$var_mysql_password"' -e \"DROP DATABASE $SITE_B_DB;
mysql -u root -p'"$var_mysql_password"' -e \"CREATE DATABASE $SITE_B_DB CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
mysql -u root -p'"$var_mysql_password"' -e \"GRANT ALL ON $SITE_B_DB.* TO '$SITE_B_USER'@'localhost';
mysql -u root -p'"$var_mysql_password"' -e \"FLUSH PRIVILEGES;
wp --allow-root db import /tmp/export2.sql # Import of the DB
sudo sed -i "s/$PREFIX1/$PREFIX2/g" $SITE_B/wp-config.php #Replace the DB name is wp-config
Thanks a lot
The text was updated successfully, but these errors were encountered:
Hi,
What would you think of a simple script like this one?
Wouldn't it be easier or am I being too simplistic using sed?
$SITE_B_DB, $SITE_B_USER, PREFIX1, PREFIX2, SITE_B would need to be replaced in the script.
Thanks a lot
The text was updated successfully, but these errors were encountered: