cd /path/to/backups
mysql -u root -h 127.0.0.1 -p --default-character-set=utf8
# Switch to database USE database_name;
SET names 'utf8';
SET autocommit=0;
SOURCE backup.sql;
COMMIT;- Note:
database_nameshould exists - Source
cd /path/to/backups
mysql -u root -h 127.0.0.1 -p --default-character-set=utf8
# Switch to database USE database_name;
SET names 'utf8';
SET autocommit=0;
SOURCE backup.sql;
COMMIT;database_name should existsExport
mongodump --uri "mongodb+srv://db-user:[email protected]/db-name?retryWrites=true&w=majority" --out ~/mongo-dbImport
mongorestore --uri "mongodb+srv://db-user:[email protected]/?retryWrites=true&w=majority" ~/mongo-dbmysqldump -u root -h 127.0.0.1 -p --all-databases > all_db.sqlmysql -u root -h 127.0.0.1 -p < all_db.sqlmysqldump --column-statistics=0 --set-gtid-purged=OFF --no-tablespaces -v -h 127.0.0.1 -u root -p database_name_here > backup_file.sqlmysql -h 127.0.0.1 -u root -p database_name_here < backup_file.sqlCREATE DATABASE my_database;
CREATE USER 'my_user'@'%' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON my_database.* TO 'my_user'@'%' WITH GRANT OPTION;# get the container id
docker container ls
# Specify the container id in next command, for example 95bf1f75af9c
docker exec 95bf1f75af9c pg_dump --no-owner --no-privileges -U postgres database_name > backup.sqldocker exec -i 95bf1f75af9c psql -U postgres database_name < /full/path/to/backup.sqlAssumptions
*.sql file created with psql commandSteps
# Syntax
ssh -L <local free port>:<RDS instance host>:<RDS port> <ec2-user>@<ec2-ip-address>
# Example command
ssh -L 5433:db-name.c13mzxjj9hpa.us-east-1.rds.amazonaws.com:5432 [email protected]psql -U postgres -p 5433 -h 127.0.0.1 -d db_name < ./path/to/db_backup_file.sql
I hope this message finds you well. I'm currently facing an issue when trying to import a PostgreSQL database backup, and I'm seeking assistance to resolve it.
The problem I'm encountering is as follows:
The error seems to indicate that I'm performing a data-only restore, and I may be missing schema objects. I would like to restore both data and schema objects, and I'm unsure how to proceed.
Any suggestions, insights, or explanations on how to address this issue would be highly valuable. Thank you in advance for your help!