Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to import dvd rental database on mac. The postgres tutorial only gives instructions for windows

Tags:

postgresql

I have downloaded the dvd rental.tar file on my desktop. followed the below instructions

pwd
/Users/O2/tools/postgres
mkdir dvdrentaldb
initdb dvdrentaldb

I get the following message

initdb directory "dvdrentaldb' exists but is not empty If you want to create a new database system either remove or empty the directory or run initdb with an argument other than "dvdrentaldb"

I have downloaded the dvd rental.tar file on my desktop. followed the below instructions

pwd
/Users/O2/tools/postgres
mkdir dvdrentaldb
initdb dvdrentaldb

post this i am using the following code

pg_restore -U O2 -d dvdrentaldb dvdrental.tar

i get syntax error at or near "pg_restore"

I get the following message

initdb directory "dvdrentaldb' exists but is not empty If you want to create a new database system either remove or empty the directory or run initdb with an argument other than "dvdrentaldb"

like image 655
Seby Avatar asked Oct 17 '25 16:10

Seby


1 Answers

Got this from reddit

https://www.reddit.com/r/PostgreSQL/comments/93uuhg/can_anyone_get_this_sample_database_tutorial_to/

createuser -s dvdrental
createdb dvdrental -O dvdrental
pg_restore -U dvdrental -d dvdrental ./dvdrental.tar
like image 153
Seby Avatar answered Oct 20 '25 08:10

Seby