Search
 
SCRIPT & CODE EXAMPLE
 

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");
  });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to loop an object in javascript 
Javascript :: electron check if file exists 
Javascript :: onclick change image src javascript 
Javascript :: How to access return value of promise 
Javascript :: check if numbers are consecutive javascript 
Javascript :: float to euro curency 
Javascript :: open bootstrap modal with javascript 
Javascript :: javascript radio button value if checked 
Javascript :: javascript reverse string 
Javascript :: how to remove duplicates in js array 
Javascript :: jest : Cannot use import statement outside a module 
Javascript :: javascript if browser out of focus 
Javascript :: how to customize js alert box 
Javascript :: creating a 2d array in js 
Javascript :: toast message angular 
Javascript :: send serialized form data jquery 
Javascript :: set auth header on axios instance 
Javascript :: how to hide title bar react-navigation 
Javascript :: javascript iterate object attribute name 
Javascript :: mongodb group by several fields 
Javascript :: nodejs user input 
Javascript :: queryselector get each element 
Javascript :: json limit express 
Javascript :: modulus of negative numbers 
Javascript :: how to show modal with jquery 
Javascript :: javascript largest number in array 
Javascript :: active js 
Javascript :: javascript sum digits in string of numbers 
Javascript :: Javascript Get day number in year from date 
Javascript :: moment js get date 1 month 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =