Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Maintenance

ZeroC0D3 Team edited this page Jan 26, 2018 · 4 revisions

Maintenance Database

Backup / Restore SQLite3

  • Install SQLite3
## Debian / Ubuntu 
sudo apt-get -y install sqlite3

## CentOS / Fedora
sudo yum -y install sqlite3
  • Backup SQLite3
sqlite3 [db_name] .dump > [dump.sql]
  • Restore SQLite3
sqlite3 [db_name] < [dump.sql]
  • Recommendation Admin Tools
DBBrowser     => http://sqlitebrowser.org/
SQLite Studio => https://sqlitestudio.pl/

Backup / Restore MySQL

  • Backup MySQL
mysqldump -h [hostname] --port=[port] -u [user_db] -p [db_name] > [dump.sql]
  • Restore MySQL
mysql -h [hostname] -u [user_db] -p [db_name] < [dump.sql]   # (Type your password after ENTER)
  • Port MySQL
3306   # default / staging / production
  • Recommendation Admin Tools
phpMyadmin => https://www.phpmyadmin.net/
adminer    => https://www.adminer.org/
DBeaver    => https://dbeaver.jkiss.org/

Backup / Restore PostgreSQL

  • Backup PostgreSQL
pg_dump --dbname=postgresql://[user_db]:[password]@[hostname]:[port]/[db_name] > [dump.sql]
  • Restore Postgresql
sudo -i -u postgres
psql -h [hostname] -p [port] -U [user_db] -W [db_name] < [dump.sql]    # (Type your password after ENTER)
  • Port PostgreSQL
5432   # default / staging
5433   # production
  • Recommendation Admin Tools
pgAdmin => https://www.pgadmin.org/
DBeaver => https://dbeaver.jkiss.org/
  • Troubleshoot
Forget postgres password => https://stackoverflow.com/questions/10845998/i-forgot-the-password-i-entered-during-postgres-installation

Backup / Restore MongoDB

  • Backup MongoDB
# Create Backup Folder
mkdir -p [path_backup]/[backup_folder_name]

# Run mongodump (without username & password)
mongodump --out [path_backup]/[backup_folder_name]   

# Run mongodump (with username & password)
mongodump --host [hostname] --port [port] --username [username] --password '[password]' --out [path_backup]/[backup_folder_name]  
  • Restore MongoDB
# Restore without username & password
mongorestore [path_backup]/[backup_folder_name]

# Restore with username & password
mongorestore --host [hostname] --port [port] --username [username] --password '[password]' [path_backup]/[backup_folder_name]
  • Port MongoDB
27017
  • Recommendation Admin Tools
robo3t   => http://www.robomongo.org
studio3t => https://studio3t.com/
Clone this wiki locally