1.安装依赖

npm install --save @nestjs/typeorm typeorm mysql

2.在主目录创建数据库配置文件ormconfig.json

{
    "type": "mysql",
    "host": "ip地址",
    "port": 3306,
    "username": "用户名",
    "password": "密码",
    "database": "数据库",
    "entities": ["dist/**/*.entity{.ts,.js}"],
    "migrations": ["migration/*.ts"],
    "timezone": "UTC",
    "charset": "utf8mb4",
    "multipleStatements": true,
    "dropSchema": false,
    "synchronize": true,
    "logging": true
}

标签: none

添加新评论