Created
June 8, 2024 19:48
-
-
Save fida02/8e798c25eae70bb844502f1255212cf2 to your computer and use it in GitHub Desktop.
SSH command list for website migration between servers
This file contains hidden or 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
| # 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