Search code examples
javascriptcommand-line-interfacesequelize.jssequelize-cli

ERROR: Access denied for user 'postgres'@'localhost' (Command Line)


I am trying to create db with sequelize cli but getting this error.

ERROR: Access denied for user 'postgres'@'localhost' (using password: NO)

Here is my config.json file

    {
  "development": {
    "username": "postgres",
    "password": "postgres",
    "database": "database_development",
    "host": "127.0.0.1",
    "dialect": "mysql"
  },
  "test": {
    "username": "root",
    "password": null,
    "database": "database_test",
    "host": "127.0.0.1",
    "dialect": "mysql"
  },
  "production": {
    "username": "root",
    "password": null,
    "database": "database_production",
    "host": "127.0.0.1",
    "dialect": "mysql"
  }
}

I can login with same user on phppgAdmin which i am currently using in config.json but its throwing the error. This is default user with all permissions and i had already created a db with ui. Any help will be appreciated.


Solution

  • Okay so after messing around with config.json i figured out the solution. If you run the commands from sequalize cli documentation sequalize cli doc then it will create the same config.json as in question. I have only modified the username and password.

    The default dialect is mysql so you need to change it with postgres and it will work.