79127608

Date: 2024-10-26 00:36:48
Score: 3
Natty:
Report link

This is 2024. If you still have the same issue, your username should be the username of your cpanel account and the password should also be the password of your cpanel account.

import { DataSource } from 'typeorm';
import { DB_USER, DB_NAME, DB_PASSWORD, NODE_ENV, DB_TYPE, DB_PORT } from "./appconfig"
const AppDataSource = new DataSource({
type: DB_TYPE,
port: DB_PORT,
host: "localhost",
database: DB_NAME,
username: DB_USER,
password: DB_PASSWORD,
entities: [] // your entities,
synchronize: true,
logging: false,
});

AppDataSource.initialize()
.then(() => {
console.log('Database ::connected');
})
.catch((err) => {
console.error('Error during Data Source initialization:', err);
});

where to find this username config in mysql

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): have the same issue
  • Low reputation (0.5):
Posted by: Samuel Tosan Ayo