Zenuncl Wiki

Genius only means hard-working all one's life...
Database

Backup

/ database / Backup

# MySQL

# All Database

mysqldump --user=$USER -password=$PASSWORD -A > ~/backup/mysql_dump.sql

# One or Multiple (But not all) Database

mysqldump --user=$USER -password=$PASSWORD -database DB_ONE DB_TWO > ~/backup/mysql_dump_db_one.sql

# Restore Database

mysql --verbose --user=$USER --password=$PASSWORD DB_ONE < ~/backup/mysql_dump_db_one.sql

# Restore All Database

mysql --verbose --user=$USER --password=$PASSWORD < ~/backup/mysql_dump.sql

# MongoDB

# Backup MongoDB

mongodump --dbpath /data/db/ --db test --out /data/backup/

# Store MongoDB

mongorestore --dbpath <database path> <path to the backup>

Reference:

Last Update: 2024-11-11 02:42:55 Source File