mysqljs / mysql

A pure node.js JavaScript Client implementing the MySQL protocol.
MIT License
18.22k stars 2.53k forks source link

Missing information in Documentation #2543

Closed azeezsodiqkayode closed 2 years ago

azeezsodiqkayode commented 2 years ago

There could be an addition to this

var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'me',
  password : 'secret',
  database : 'my_db'
});

connection.connect();

connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
  if (error) throw error;
  console.log('The solution is: ', results[0].solution);
});

connection.end();

WHAT HAPPENS WHEN MY DEFAULT PORT IS IN USE 3306 
It should be stated that port can be declared 

var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'me',
  password : 'secret',
  database : 'my_db'
  port: "8800"
});
mbaumgartl commented 2 years ago

Hey!

The port property is already documented in the connection options.

Regards, Marco