简体   繁体   English

错误:connect ECONNREFUSED::1:3306 是当我尝试在 nestjs 中使用 typeorm 时

[英]Error: connect ECONNREFUSED ::1:3306 is when i try to use typeorm in nestjs

This error when i try to use typeorm in nestjs当我尝试在 nestjs 中使用 typeorm 时出现此错误

i did setting for using typeorm like this我做了像这样使用 typeorm 的设置

app.module.ts应用程序模块.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 { }

Some People said "You have to start mysql" so i did "mysql.server start" or "mysql.server restart" but error still lives..有些人说“你必须启动 mysql”所以我做了“mysql.server start”或“mysql.server restart”但错误仍然存在..

if you want to see anthor code i can show that如果你想看 anthor code 我可以证明

i can not do nothing cuz this erorr我无能为力因为这个错误

plz help me..请帮助我..

Edit your /etc/hosts and remove the line starting with::1编辑 /etc/hosts 并删除以 ::1 开头的行

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeORM 与 MySQL ECONNREFUSED 10.104.38.229:3306 在 kubernetes pod 上运行时 - TypeORM with MySQL ECONNREFUSED 10.104.38.229:3306 when running on kubernetes pod 启动我的 node.js 应用程序时出现错误 connect ECONNREFUSED 127.0.0.1:3306 - Get error connect ECONNREFUSED 127.0.0.1:3306 when start my node.js app 连接到 mysql 时出现错误“connect ECONNREFUSED 127.0.0.1:3306” - Getting error "connect ECONNREFUSED 127.0.0.1:3306" while connecting to mysql 错误:连接 ECONNREFUSED 185.248.177.110:3306 at TCPConnectWrap.afterConnect [as oncomplete],cpanel - Error: connect ECONNREFUSED 185.248.177.110:3306 at TCPConnectWrap.afterConnect [as oncomplete], cpanel 错误:在 MySQL、Heroku 和 Node.js 上连接 ECONNREFUSED 127.0.0.1:3306 - Error: connect ECONNREFUSED 127.0.0.1:3306 on MySQL, Heroku, and Node.js [SequelizeConnectionRefusedError]:连接ECONNREFUSED 127.0.0.1:3306 - [SequelizeConnectionRefusedError]: connect ECONNREFUSED 127.0.0.1:3306 SequelizeConnectionRefusedError:连接 ECONNREFUSED 127.0.0.1:3306 - SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306 Docker Compose 连接 ECONNREFUSED 172.18.0.4:3306 - Docker Compose connect ECONNREFUSED 172.18.0.4:3306 未处理的拒绝 SequelizeConnectionRefusedError:连接 ECONNREFUSED 127.0.0.1:3306 - Unhandled rejection SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306 在 docker 中使用 jest 连接 ECONNREFUSED 127.0.0.1:3306 - connect ECONNREFUSED 127.0.0.1:3306 with using jest in docker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM