Skip to content

Instantly share code, notes, and snippets.

@fida02
Created June 8, 2024 19:48
Show Gist options
  • Select an option

  • Save fida02/8e798c25eae70bb844502f1255212cf2 to your computer and use it in GitHub Desktop.

Select an option

Save fida02/8e798c25eae70bb844502f1255212cf2 to your computer and use it in GitHub Desktop.
SSH command list for website migration between servers
# Source server commands #
# Database backup
mysqldump -u USER -pPASSWORD DATABASENAME > mydb.sql
# Zip all files and database backup
zip -r mysite.zip .
# Destination server commands #
# Download the zip file to the destination
wget https://mywebsiteaddress.com/mysite.zip
#Unzip the downloaded file
unzip mysite.zip; rm ./mysite.zip;
# Fix permission for the unzipped files
chown -R www-data:www-data .
# Database restore
mysql -u USER -pPASSWORD DATABASENAME < mydb.sql
# Remove the database backup file
rm ./mydb.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment