Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Creating a Node.js MySQL Database

var mysql = require('mysql')

var con = mysql.createConnection({
  host: "localhost",
  user: "yourusername",
  password: "yourpassword"
});

con.connect(function(err) {
  if (err) throw err;
  console.log("Connected!");
  con.query("CREATE DATABASE mydb", function (err, result) {
    if (err) throw err;
    console.log("Database created");
  });
});
 
PREVIOUS NEXT
Tagged: #Creating #MySQL #Database
ADD COMMENT
Topic
Name
5+5 =