typeorm: [Nest] 487576 [TypeOrmModule] Unable to connect to the database. Retrying (9)...

Issue type:

[ x] question [ ] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ x] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version:

[ ] latest [ ] @next [x ] 0.2.24 (or put your version here)

Steps to reproduce or a small repository showing the problem:

Hi! I have problem with connection to database. On first server application start without erorrs and don’t have problems with connection to db. On the second server I have error ‘Unable to connect to the database’. On second server I can check connection in manager DB, and it works. What can go wrong?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (5 by maintainers)

Most upvoted comments

I was facing a similar problem and using the mysql2 module helped me.

$ npm install mysql2 --save
$ npm uninstall mysql --save

You can also try --tls-min-v1.0 when running node

https://github.com/nodejs/node/issues/27384

This issue was caused by node.js version. With node.js 10.19.0 my app work, but with node.js v 12.x.x - not.

For me, it is An Error that the entity directory is fasle.

     entities: [__dirname + '/**/entity/*.entity{.ts,.js}'], 

Change the directory and You can see it works.

You can also try --tls-min-v1.0 when running node

nodejs/node#27384

node --tls-min-v1.0 app.js

this worked for me (node 14.15.1),

thanks very much @imnotjames