17 lines
375 B
JavaScript
17 lines
375 B
JavaScript
import { createConnection } from "mysql2";
|
|
|
|
const connection = createConnection({
|
|
host: "localhost",
|
|
user: "root",
|
|
database: "customers_db",
|
|
});
|
|
|
|
connection.connect((err) => {
|
|
if (err) {
|
|
console.error("Error connecting to the database:", err);
|
|
} else {
|
|
console.log("Connected to the MySQL database!");
|
|
}
|
|
});
|
|
|
|
export default connection; |