When starting a new project with a Postgres database, you'll want to do the following things to set it up:
Depending on which operating system you're on, you'll need to do the following:
- Open your terminal
- Run
psql --username=postgres
, enter the password you made for postgres - Once you're in the psql prompt, run
CREATE DATABASE <name_of_database>;
MAKE SURE YOU SEMICOLON!
- Open the SQL Prompt (Search psql in the application finder)
- Hit enter through all of the default options
- Enter your postgres password when prompted
- Once you're in the psql prompt, run
CREATE DATABASE <name_of_database>;
MAKE SURE YOU SEMICOLON!
- Open your terminal
- Run
psql --username=postgres -W
, enter the password you made for postgres - Once you're in the psql prompt, run
CREATE DATABASE <name_of_database>;
MAKE SURE YOU SEMICOLON!
* If you followed this guide, you should be able to leave out --username=postgres -W
*If you get an error about no database running, run sudo service postgresql start
Depending on which GUI you have installed, you'll need to do different things
- Open up the PSequel application
- Hit "Add Connection" in the bottom left
- Fill out the form with the following data:
- Try to connect!
- Open up the Sqlectron application
- Hit "Add" in the upper right
- Fill out the form with the following data:
- Run "Test" before saving
- If all goes well, go ahead and save
*If test is still greyed out, that means you missed a field. Make sure you set database type in the top right!
Your project probably requires some tables to be set up. Where you do that depends on which GUI you're using:
- Connect to the database you set up previously
- In the top center of the application, click the "Query" tab
- Enter your
CREATE TABLE ...
query and hit "Run Query" - Hit the refresh button in the bottom left of the application, you should see your new table
- Connect to the database you set up previously
- In the center of the screen, you should have a SQL prompt
- Enter your
CREATE TABLE ...
query and hit "Execute" - Expand your database on the left side, and search for the name of your table, you should see
public.<name_of_table>