Danh mục: Bash – sh
-
import mysql with special port
mysql -h 127.0.0.1 -P 3307 -uroot -p db_name < /db.sql
-
library lq link
Firstly, I run these commands: brew install libpq brew link –force libpq Then: PQ_LIB_DIR=”$(brew –prefix libpq)/lib” cargo install diesel_cli –no-default-features –features postgres I solved it with: cargo clean later cargo build
-
alias python
Open ~/.bash_profile file. vi ~/.bash_profile Then put the alias as follows: alias python=’python3′ Now save the file and then run the ~/.bash_profile file. source ~/.bash_profile Congratulation !!! Now, you can use python3 by typing python. python –version Python 3.7.3
-
Config remote mysqldump without password
Edit: ~/.my.cnf [mysqldump] user=root password=123456
-
Bash backup hệ thống
Tự động remove file: #!/bin/bash cd /home/backup/databases/ && (ls database-* -t|head -n 100;ls database-*)|sort|uniq -u|xargs rm Backup database từ server khác đã add ssh key: #!/bin/bash ssh user@example.com “mysqldump –column-statistics=0 {DATABASE_NAME} -h 127.0.0.1 –port=3306 -u{MYSQL_USER_NAME}” > ~/backup/databases/database-$(date ‘+%d-%m-%Y_%H:%M:%S’).sql Tạo crontab: 10 * * * * /home/backup/backup-database.sh 10 23 * * * /home/backup/auto-remove.sh Backup storage Bỏ…