Untuk backup MySQL dapat menggunakan mysqldump
mysqldump -e –u [username] -p [password] -h [hostname] [database name] > [filename].sql
Untuk backup semua database:
sudo mysql -u root -N -e 'show databases where `Database` not in("information_schema","performance_schema","phpmyadmin")' | while read dbname; do sudo mysqldump -u root --complete-insert --routines --triggers --single-transaction "$dbname" > "$dbname"_$(date +%Y%m%d_%H%M%S).sql; done
Untuk restore MySQL Database dapat menggunakan command berikut:
mysql -u username -p database_name < backup_name.sql
Recent Comments