25 lines
519 B
JavaScript
25 lines
519 B
JavaScript
// dbConfig.js
|
|
const mysql = require('mysql');
|
|
|
|
const connection = mysql.createConnection({
|
|
host: 'localhost',
|
|
user: 'root',
|
|
password: '',
|
|
database: 'community_rule',
|
|
});
|
|
// const mysql = require('mysql2');
|
|
|
|
// const connection = mysql.createConnection({
|
|
// host: 'localhost',
|
|
// user: 'root',
|
|
// password: 'your_mysql_password',
|
|
// database: 'your_database_name',
|
|
// });
|
|
|
|
connection.connect((err) => {
|
|
if (err) throw err;
|
|
console.log('Connected to the database');
|
|
});
|
|
|
|
module.exports = connection;
|