Cannot connect to Postgres DB I'm new to Postgres and I am trying to implement it through the command line. I just used it previously in a project, but that was by downloading Postgres.app and Postico. I wanted to go through the process of setting up a database through the command line. I installed postgres using Homebrew, and that was fine. I'm trying to follow this tutorial:

https://www.codementor.io/@engineerapart/getting-started-with-postgresql-on-mac-osx-are8jcopb

For some reason, none of the wrapper commands work for me. I wasn't able to use createuser, but running CREATE ROLE patrick WITH LOGIN PASSWORD 'quoted password' was fine.

When I run the \du command, I get the following:

     Role name     |                         Attributes                         | Member of 
-------------------+------------------------------------------------------------+-----------
 patrick           | Create DB                                                  | {}
 patrickshushereba | Superuser, Create role, Create DB, Replication, Bypass RLS | {}


Which I believe is what I want. Because I created an account that isn't a superuser account.

I also ran \list to make sure that the databases that I wanted to use were created correctly.

  List of databases
        Name        |       Owner       | Encoding | Collate | Ctype |            Access privileges            
--------------------+-------------------+----------+---------+-------+-----------------------------------------
 bridgeworq         | patrick           | UTF8     | C       | C     | =Tc/patrick                            +
                    |                   |          |         |       | patrick=CTc/patrick
 bridgeworq_testing | patrick           | UTF8     | C       | C     | =Tc/patrick                            +
                    |                   |          |         |       | patrick=CTc/patrick
 postgres           | patrickshushereba | UTF8     | C       | C     | 
 template0          | patrickshushereba | UTF8     | C       | C     | =c/patrickshushereba                   +
                    |                   |          |         |       | patrickshushereba=CTc/patrickshushereba
 template1          | patrickshushereba | UTF8     | C       | C     | =c/patrickshushereba                   +



The first two in the list are the ones that I want to connect to. I'm using Knex.js and node.js to build my backend.

Here is the development object inside of my knexfile:

development: {
    client: 'pg',
    connection: {
      filename: 'postgresql://localhost/bridgeworq'
    },
    migrations: {
      directory: './data/migrations'
    },
    seeds: {
      directory: './data/seeds'
    }
  }


My problem is that when I try to run my migrations, I get the following error:

error: database "patrickshushereba" does not exist.

I haven't found any good resources to troubleshoot what is wrong. What else should I be doing in the command line to make sure that the user that I want to use patrick is connected to the database that I want to use? And if anyone is by chance familiar with Knex, is that the right way to connect to the database? Or do I need to be using a different path? Sorry for the long winded amateur question. But I'd really like to learn how to do this, and what the workflow is for setting stuff up, and I wanted to be thorough. Any help or resources would be greatly appreciated.
It turned out that I was creating the database and the user correctly. What I was doing wrong was not connecting to my database correctly through the Knexfile.

I looked at the docs from http://knexjs.org/

Once I adjusted the object in my knexfile to specify the database, I was able to run my migrations successfully.