You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
486 B
21 lines
486 B
var response_text="";
|
|
|
|
const mysql = require('mysql');
|
|
const connection = mysql.createConnection({
|
|
host: 'localhost',
|
|
user: 'root',
|
|
password: 'root',
|
|
database: 'nodeapi'
|
|
});
|
|
|
|
connection.connect((err) => {
|
|
if (err) throw err;
|
|
console.log('Connected to MySQL Server!');
|
|
});
|
|
|
|
connection.query("SHOW tables", function (err, rows) {
|
|
console.log(rows);
|
|
response_text += rows.length + " table" + (rows.length > 1 ? "s" : "") + " found";
|
|
console.log(response_text);
|
|
});
|