JS Lab 2
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user