Lab 00 - PostgreSQL Setup
In this assignment, you'll set up your own instance of the PostgreSQL server on your own computer.
PostgreSQL is the datbase engine we'll be using for most of this course. You'll need to install this on your personal computer.
Note that unless otherwise specified, all assignments should use the command line
psql tool for these operations, not a GUI client, as this will help you to learn and practice the SQL syntax.
1. Install Postgres
Follow the PostgreSQL install instructions for your operating system to install the latest version of PostgreSQL.
For macOS and Windows, you'll want to choose the EnterpriseDB installer option. At the end of the installation, you'll be asked if you want to launch stack builder, you should uncheck the stack builder checkbox before continuing.
2. Configure Your Path if Necessary
Once you have installed PostgreSQL, modify your path if necessary so that you can access the
psql command from the command line.
If you've never done this before, you'll probably want to google something like:
how to change system path on ???
Where ??? is your operating system.
3. Configure the Server
With your command line tools configured, follow the instructions of section 3 (Configuring Postgres), parts A, A1, B, and B1. here to configure a user (AKA role) on your Postgres server, add a database, and give the role you created access to that database.
Note that even though the linked instructions are for installing Postgres on a mac, the instructions for interacting with the server through
psql command are the same.
Passwords and Windows
If you're having trouble logging in to postgres on Windows, note that some versions of windows will try to log you in using your username by default, rather than the
When you attempt to login, notice how it says
Password authentication failed for user YOURUSERNAME rather than the
psql --help reveals more options you can use for your connection:
Near the bottom, you'll see the option for setting the username and that it defaults to your windows login name:
So on Windows, to use the postgres username, use:
The password will be the password you specified when you first run the installer:
Also note that on windows, if you want to log in with your new user to the postgres database, you have to use
-d to specify it:
psql -d postgres -UUSERNAME
4. Display the Databases and Users
Once you have have compelted the above items, execute the
\du commands to display a list of your databases and users, and submit a screenshot of the output to mySVU.