Couldn't run with db PostgreSQL
See original GitHub issueHi, I new here. Went through the Quickstart tutorial and trying to test it out with sqlite and PostgreSQL. sqlite works fine but i cant get PostgreSQL to work. Help is appreciated. Thank you!
ormconfig.json
{
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "test",
"password": "test",
"database": "test",
"synchronize": true,
"logging": false,
"entities": [
"src/entity/**/*.ts"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
]
}
npm start
{ Error: connect ECONNREFUSED 127.0.0.1:5432 at Object._errnoException (util.js:1019:11) at _exceptionWithHostPort (util.js:1041:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1175:14) code: ‘ECONNREFUSED’, errno: ‘ECONNREFUSED’, syscall: ‘connect’, address: ‘127.0.0.1’, port: 5432 }
package.json
{
"name": "MyProject",
"version": "0.0.1",
"description": "Awesome project developed with TypeORM.",
"devDependencies": {
"ts-node": "3.3.0",
"@types/node": "^8.0.29",
"typescript": "2.5.2"
},
"dependencies": {
"pg": "^7.3.0",
"reflect-metadata": "^0.1.10",
"typeorm": "0.1.1"
},
"scripts": {
"start": "ts-node src/index.ts"
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
PostgreSQL: Why psql can't connect to server? - Stack Overflow
The error states that the psql utility can't find the socket to connect to your database server. Either you don't have the database...
Read more >15: 19.3. Starting the Database Server - PostgreSQL
Before anyone can access the database, you must start the database server. The database server program is called postgres .
Read more >Homebrew Postgresql Service not Starting Resolved
This post will cover how to troubleshoot when the postgresql service installed via Homebrew on a Mac isn't starting. If you work on...
Read more >Why my Rails Projects Couldn't Connect to Postgresql
Whenever you're doing an initial rails setup with postgres you run… $ rails db:setup. this will set up the test and development databases...
Read more >Setting up a PostgreSQL Database on Mac - SQLShack
Once the postgres server is up and running, the next step is to configure it for use. We are going to create a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
no, I mean
postgres
application. Did you install postgres application ? Do you have experience working with databases at all?Since Docker is a virtual machine, you have to use its ip to connect to your database.
If you’re using Windows, try the following command in Docker’s terminal:
docker-machine ip
Put this ip in HOST (in whatever GUI you’re using, in my case, postbird) instead of using “localhost”.Make sure you use the correct port as well. You can check which port the database is using by doing
docker ps
to list any running container. If none is returned in the above command, usedocker ps -a
to list all containers and thendocker start NAME
, where NAME is the name of the database you want to start.Hope this helps.