上QQ阅读APP看书,第一时间看更新
Editing the config.js file with database credentials
As we can see, the sequelize
command creates many files, including a database configuration file. This file has a sample configuration for application databases.
- Open
config/config.json
and edit thedevelopment
tag with our database details, as the following highlighted code:{ "development": { "username": "root", "password": "", "database": "mvc_mysql_app", "host": "127.0.0.1", "port": "3306", "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" } }
Tip
Note that I'm using user root with no password to connect with my database, if you have a different user or are using a different password, replace the previous code with your own credentials.