SQL: Postgres import .dump file

# 1. Create the user (if it doesn't exist)
sudo -u postgres createuser toxlab

# 2. Create the database with the correct owner
sudo -u postgres createdb -O toxlab toxrefdb_3_0

# 3. Import the data (try this one first)
pg_restore -U toxlab -d toxrefdb_3_0 -v toxrefdb_3_0.dump

# If connecting over LAN: 
# -h <server_ip>: Specifies the hostname or IP address of the server to connect to.
# -W: Forces a password prompt. This is good practice.
pg_restore -h 192.168.1.100 -U toxlab -d toxrefdb_3_0 -v -W toxrefdb_3_0.dump

# 4. If pg_restore fails, use this one instead
psql -U toxlab -d toxrefdb_3_0 < toxrefdb_3_0.dump

# 5 Import the dump file
psql -U toxlab -d toxrefdb_3_0 < toxrefdb_3_0.dump

# .. or over LAN
psql -h 192.168.1.100 -U toxlab -d toxrefdb_3_0 -W < toxrefdb_3_0.dump


After the import is complete, you can connect to your new database and verify the data is there

# Connect to the database
psql -U toxlab -d toxrefdb_3_0

# Once inside psql, list the tables to verify
\dt

"I’m here to fix deine kabel"