You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After downloading the file, extract to a folder of your choice. Take note of the file path of selected folder.
In my case, I extracted it to the Database folder found in Downloads.
Make your way through Database in the terminal and take note of the file path.
Open and Replace (optional)
From the extracted files, open restore.sql and replace postgres with the username of superuser or owner of a database.
If you don't know who the superuser is, by default (during installation), it is postgres. To check, run psql -l in the terminal and it is usually the owner.
In my case the superuser is raasdillo and so I replace all postgres in restore.sql with raasdillo. Remember to save.
Additionally, replace $$PATH$$ with the file path determined from earlier. Remember to save.
Create "dvdrental" Database
(This step is actually redundant because restore.sql will create a dvdrental database on its own)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Download and Extract
After downloading the file, extract to a folder of your choice. Take note of the file path of selected folder.
In my case, I extracted it to the Database folder found in Downloads.
Make your way through Database in the terminal and take note of the file path.
Open and Replace (optional)
From the extracted files, open restore.sql and replace postgres with the username of superuser or owner of a database.
If you don't know who the superuser is, by default (during installation), it is postgres. To check, run
psql -l
in the terminal and it is usually the owner.In my case the superuser is raasdillo and so I replace all postgres in restore.sql with raasdillo. Remember to save.
Additionally, replace $$PATH$$ with the file path determined from earlier. Remember to save.
Create "dvdrental" Database
(This step is actually redundant because restore.sql will create a dvdrental database on its own)
As instructed in https://github.com/smashedtoatoms/asdf-postgres#run, run
pg_ctl start
and thencreatedb dvdrental
. You can check that dvdrental is created by running againpsql -l
.Import Database to "dvdrental"
Finally, we import the downloaded database to dvdrental by running
psql -d dbname -U username -f filepath/restore.sql
.In my case:
psql -d dvdrental -U raasdillo -f /home/raasdillo/Downloads/Database/restore.sql
.And we can check that data is indeed accessible.
Note
This is actually, in a sense, a brute force method that I found by tinkering/playing around with the error messages. Hope this works for you tho.
Beta Was this translation helpful? Give feedback.
All reactions