Using psql to bulk import data

I am trying to use psql utility to bulk import data in cockroachDB.
I created a .sql dump using pg_dump and facing issues while importing this in cockroachDB.

Please let me know how to workaround this issue.
I know that psql is by default pointing to postgresql and not to cockroachDB.

Hi rave,

Glad you’re giving CockroachDB a try! By default, psql tries to connect to the Unix domain socket located in /var/run/postgresql/..., as you can see in the error message above. To solve your immediate issue, just pass -h localhost to psql:

$ psql -h localhost -p 26257 ...

You can also use a connection string to specify everything in one argument:

psql postgres://localhost:26257

Alternatively, why not use cockroach sql? It’ll read from stdin just like psql.

$ cockroach sql < FILE

Cheers!

1 Like

Hi benesch,

Thanks for your reply, that worked fine!

Cheers!