Skip to content

Detailed Windows PostgreSQL installation

Edorn71 edited this page Oct 6, 2018 · 13 revisions

Step-by-step installation of PostgreSQL

Windows 8 (64-bit) OS

  1. Download PostgreSQL-9.3.0-1-windows.exe

  2. Try to run downloaded file but halted by too smart for its own good OS

  1. Click More info and Run anyway
  1. Setup wizard begins, click Next
  1. Specify installation directory, click Next
  1. Specify data directory, click Next
  1. Assign password for superuser named postgres, click Next
  1. Leave port number with default 5432, click Next
  1. Leave Advanced Options locale with [Default locale], click Next
  1. Wizard complete, ready to install, click Next
  1. Wait while installation completes
  1. Finished installing, click Finish
  1. A new wizard opens up - Stack Builder 3.1.1; This wizard we are going to ignore. Click Cancel -> Yes
  1. Open Command Prompt and navigate to the install location selected in step 5. above
  1. createuser.exe -U postgres -E -P nfldb
    Using superuser postgres, create a new user named nfldb. Assign a password for user nfldb, enter it again to confirm, and finally enter the password for account postgres that you assigned in step 7. above
  1. createdb.exe -U postgres -O nfldb nfldb
    Using superuser postgres, create a new database named nfldb. Make the owner of this database user nfldb
  1. psql.exe -U postgres -c "CREATE EXTENSION fuzzystrmatch;" nfldb
    Enable fuzzy string matching
  1. psql.exe -U nfldb nfldb
    Using user nfldb, log into database nfldb

\q to exit

  1. Download nfldb.sql.zip

  2. Extract downloaded zip file

  1. psql.exe -U nfldb nfldb < x:\path\to\extracted\nfldb.sql\nfldb.sql
    Using user nfldb, import the downloaded sql database into database nfldb

Please note that you are importing the nfldb.sql file that you unzipped and not the nfldb.sql folder that the file resides in.
If you are seeing Access is denied. it is likely that you are trying to incorrectly import the folder_

  1. Wait for database to import - took me about 6 minutes on older PC
  1. Create a copy of the sample config file found in x:\Python27\share\nfldb

Rename this copy config.ini

Edit two values in this config file: the timezone & the password for user nfldb; save and close the file

  1. Create and save a file called top-ten-qbs.py
import nfldb

db = nfldb.connect()
q = nfldb.Query(db)

q.game(season_year=2012, season_type='Regular')
for pp in q.sort('passing_yds').limit(10).as_aggregate():
    print pp.player, pp.passing_yds
  1. From a command prompt, run python top-ten-qbs.py
  1. Finally, run the nfldb-update script found in the Python\Scripts folder
  1. Congratulations - no one in the world has a more up-to-date nfldb database than you.