Advertisement
Guest User

Untitled

a guest
Mar 11th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. var mysql = require("mysql");
  2. // First you need to create a connection to the db
  3. var con = mysql.createConnection({
  4. host: "localhost",
  5. user: "test",
  6. password: "test"
  7. });
  8.  
  9. con.connect(function(err){
  10. if(err){
  11. console.log('Error connecting to Db');
  12. return;
  13. }
  14. console.log('Connection established');
  15. });
  16.  
  17. con.end(function(err) {
  18. // The connection is terminated gracefully
  19. // Ensures all previously enqueued queries are still
  20. // before sending a COM_QUIT packet to the MySQL server.
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement