一、连接mysql 8.0一直报错,可能是由于版本问题这边提供的解决方式
1.npm uninstall mysql // 一定要删除
2.npm i mysql2
3.找到app.module.ts 文件
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (configService: ConfigService) => ({
type: 'mysql',
connectorPackage: "mysql2", // 这边的包指向
}),
}),