You must do this every time you restart your machine.
sudo service postgresql start
brew services start postgresql
After you have run this command the first time, postgres will start automatically whenever you boot up your computer.
Open the shell and connect to the city_explorer database:
psql city_explorer
With no arguments, psql
will start the shell connected to your user-default database.
This will create a new database called "book_wiki", which can contain many individual tables:
CREATE DATABASE book_wiki;
Type the backslash character, immediatly followed by a "q":
yourname=# \q
yourname=# \l
yourname=# \c book_wiki
yourname=# \dt
The command dt
means "describe table".
yourname=# \d table-name
psql: could not connect to server: No such file or directory
See above notes about starting the server.
When connecting your schema.sql to your database:
schema.sql: No such file or directory
You must specify the full path to the .sql file or run the command from the same directory where the .sql file lives.