About node. js

Source: Internet
Author: User

var mysql      = require (' mysql '); var connection = Mysql.createconnection ({  host     : ' localhost ',  user     : ' Root ',  password: ' 123456 ',  database: ' Test '}); 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);});

  

Parameters Description
Host Host address (default: localhost)
User User name
Password Password
Port Port number (default: 3306)
Database Database name
CharSet Connection character Set (default: ' Utf8_general_ci ', note that character set letters are capitalized)
LocalAddress This IP is used for TCP connections (optional)
Socketpath Connect to a UNIX domain path that is ignored when host and Port are used
TimeZone Time zone (default: ' Local ')
ConnectTimeout Connection Timeout (default: No Limit; units: milliseconds)
Stringifyobjects Whether the object is serialized
Typecast Whether to convert column values to local JavaScript type values (default: TRUE)
Queryformat Custom query statement formatting methods
Supportbignumbers This option is required when the database supports bigint or decimal type columns, which is True (default: false)
Bignumberstrings Supportbignumbers and bignumberstrings enable force bigint or decimal columns to be returned as JavaScript string types (default: false)
Datestrings Force the Timestamp,datetime,data type to be returned as a string type instead of a JavaScript date type (default: false)
Debug Turn on debug (default: false)
Multiplestatements Do you want to have multiple MySQL statements in a query (default: false)
Flags Used to modify connection flags
Qs. Use the SSL parameter (one to the crypto.createcredenitals parameter format) or a string that contains the SSL profile name, currently only bundled with Amazon RDS configuration files

About node. js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.