当我尝试在nestjs中使用typeorm时,出现了此错误。
我设置了像这样使用打字机
app.module.ts
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
import { UserModule } from './user/user.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import config from './ormconfig';
import { User } from './user/user.entity';
@Module({
imports: [
TypeOrmModule.forRoot({
type: 'mysql', //Database 설정
host: 'localhost',
port: 3306,
username: 'root',
password: "",
database: 'hinest',
entities: [User], // Entity 연결
synchronize: true,
}),
GraphQLModule.forRoot<ApolloDriverConfig>({
driver: ApolloDriver,
debug: false,
playground: false,
autoSchemaFile: 'schema.gpl'
}),
UserModule,
TypeOrmModule.forFeature([User])
],
controllers: [],
providers: [],
})
export class AppModule { }有人说“您必须启动mysql”,所以我做了"mysql.server启动“或"mysql.server重新启动”,但是错误仍然存在。
如果你想看炭疽代码,我可以向你展示
我什么也做不了,因为这是我的错
请帮帮我..。
发布于 2022-11-30 18:22:20
编辑您的/etc/host并删除以:1开头的行
https://stackoverflow.com/questions/72076107
复制相似问题