Loiselle
Loiselle

Reputation: 482

CockroachDB username in NodeJS (pg) connection string?

When I started my cluster, it didn't require that I specify a username, so I'm not sure what I should use to connect.

Here's the connection string I'm trying to use with pg:

var config = {
  user: '???',
  host: 'localhost',
  database: 'mydb',
  port: 26257
};

Upvotes: 2

Views: 124

Answers (1)

Loiselle
Loiselle

Reputation: 482

CockroachDB's default user is called root.

So, in your code example above, you'd use this:

var config = {
  user: 'root',
  host: 'localhost',
  database: 'mydb',
  port: 26257
};

You can also create your own users using cockroach user set, and those users would also need certificates if you want to use them in a secure/production environment.

Upvotes: 2

Related Questions