连接表示与数据库的连接,一个连接可以包含多个存储库。在TypeORM中使用createConnection方法创建一个连接。

const connection = await createConnection({
  type: "mysql",
  host: "localhost",
  port: 3306,
  username: "root",
  password: "password",
  database: "mydb",
});