작성자 없음
작성자 정보가 삭제된 글입니다.
해결된 질문
작성
·
815
·
수정됨
0
DB연결 문제라고 해서, 처음부터 새로 생성해서 시도해보았으나, 에러 코드가 동일하게 출력됩니다ㅠㅠ
==============================
시도해본 것들
mysql 비밀번호 초기화, 재설정
mysql db 다시 세팅
dotenv 코드말고 직접 데이터베이스 정보 입력후 실행
터미널 메세지
base) C:\Users\user\Downloads\master\a-nest> npm run db:create
> a-nest@0.0.1 db:create
> ts-node ./node_modules/typeorm-extension/dist/cli/index.js db:create -d ./dataSource.ts
C:\Users\user\Downloads\master\a-nest\node_modules\mysql2\lib\packets\packet.js:728
const err = new Error(message);
^
Error: Access denied for user ''@'localhost' (using password: YES)
at Packet.asError (C:\Users\user\Downloads\master\a-nest\node_modules\mysql2\lib\packets\packet.js:728:17)
at ClientHandshake.execute (C:\Users\user\Downloads\master\a-nest\node_modules\mysql2\lib\commands\command.js:29:26)
at Connection.handlePacket (C:\Users\user\Downloads\master\a-nest\node_modules\mysql2\lib\connection.js:489:32)
at PacketParser.onPacket (C:\Users\user\Downloads\master\a-nest\node_modules\mysql2\lib\connection.js:94:12)
at PacketParser.executeStart (C:\Users\user\Downloads\master\a-nest\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket.<anonymous> (C:\Users\user\Downloads\master\a-nest\node_modules\mysql2\lib\connection.js:101:25)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9) {
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '28000',
sqlMessage: "Access denied for user ''@'localhost' (using password: YES)",
sql: undefined.
}
app.module.ts
@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true }),
TypeOrmModule.forRoot({
type: 'mysql',
host: 'localhost',
port: 3307,
autoLoadEntities: true,
entities: [
ChannelChats,
ChannelMembers,
Channels,
DMs,
Mentions,
Users,
WorkspaceMembers,
Workspaces,
],
keepConnectionAlive: true,
migrations: [__dirname + '/migrations/*.ts'],
charset: 'utf8mb4_general_ci',
synchronize: false,
logging: true,
}),
TypeOrmModule.forFeature([Users]),
UsersModule,
WorkspacesModule,
ChannelsModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer): void {
consumer.apply(LoggerMiddleware).forRoutes('*');
// consumer.apply(FrontendMiddleware).forRoutes({
// path: '/**',
// method: RequestMethod.ALL,
// });
}
}
성공했습니다 :) 감사합니다!