Importieren Sie SQL Single Table Dump in Postgres

# If you have already created DB then don't need to follow 1st step:-

# STEP=1

# open terminal then run following commands to create postgres database and user:-

sudo -u postgres psql

postgres=# create database mydb;

postgres=# create user myuser with encrypted password 'mypass';

postgres=# grant all privileges on database mydb to myuser;

# STEP=2

# \c used for selecting your database.

postgres=# \c yourdatabasename

# \i used for importing dump data in database.

yourdatabasename=# \i path_of_your_dump_file for example:-

yourdatabasename=# \i /home/developer/projects/django_projects/db_dump.sql

# If you face this type of error when you importing data:-

# ERROR:  role "yourusername" does not exist

# so you can make superuser to your "db_user/yourusername" using this command:-

postgres=# ALTER USER fusion WITH SUPERUSER;

ALTER ROLE
Terrible Tapir