0

In doing a react application, I'm trying to use a migration from CLI using the npx mikro-orm migration:create command.

I have my export default's type set as "mysql", my database is created, but when I run the command, it returns the following error :

Error: connect ECONNREFUSED 127.0.0.1:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3306,
  fatal: true
}

I was just trying to follow a tutorial, except the tutorial used postgresql, so I don't really know where to start looking to fix the problem. I suppose it's got something to do with the ports and addresses and things of the two services not being synchronized but that's just a wild guess... Could someone point me towards an actual solution ?

Morgade
  • 33
  • 7

1 Answers1

1

I've been through the same problem and after a lot of research I just gave up and decided to change my db for sqlite3.

sudo apt-get sqlite3

Then you just need to install

 npm i @mikro-orm/sqlite

Then type

 sqlite3

It will open the sqlite3> your_database.db

CHANGE dbName and type inside mikro-orm.config.ts file and it should work fine without password.

and then run your migration normally: npx mikro-orm migration:create

these problems are wasting of time and we should go ahead and enjoy the tutorial.