Last active
December 24, 2023 17:41
-
-
Save khoipro/436dee000ec2e664f1198cbea0105632 to your computer and use it in GitHub Desktop.
Useful commands for interacting with Ubuntu/*nix OS
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
# import db .sql to site | |
# tutorial: https://fullstack-tutorials.com/mysql/mysql-import-database-from-sql-file-in-linux | |
gunzip < dump.sql.gz | mysql -u username -p database | |
# extract db to .sql.gz | |
# tutorial: https://fullstack-tutorials.com/mysql/mysql-export-database-to-gzip-file-in-linux | |
mysqldump -u username -p database_name | gzip > dump.sql.gz | |
# migrate folder uploads/ to other remote SSH port | |
# (runcloud => runcloud), for cPanel + Directadmin, see a tutorial | |
# tutorial: https://codetot.net/chuyen-thu-muc-giua-hai-may-chu-su-dung-ssh-va-rsync/ | |
rsync -zaP uploads/ -e 'ssh -p 22' [email protected]:/home/runcloud/webapps/codetot.com/wp-content/uploads | |
## Use Case: import db .sql.gz from Amazon Lightsail Instance to Database. | |
zcat db-backup.sql.gz | mysql --host [db_endpoint_path].ap-southeast-1.rds.amazonaws.com --user=dbmasteruser --database [db_name] --password | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment