@@ -92,16 +92,9 @@ The recommended way to establish a connection is this:
92
92
``` js
93
93
var mysql = require (' mysql' );
94
94
var connection = mysql .createConnection ({
95
- host : String , // defaults to 'localhost'
96
- port : Number , // defaults to 3306
97
- socketPath : String , // defaults to undefined
98
- user : String , // defaults to undefined
99
- password : String , // defaults to undefined
100
- database : String , // defaults to undefined
101
- charset : String , // defaults to 'UTF8_GENERAL_CI'
102
- insecureAuth : Boolean , // defaults to false
103
- typeCast : Boolean , // defaults to true
104
- debug : Boolean , // defaults to false
95
+ host : ' example.org' ,
96
+ user : ' bob' ,
97
+ password : ' secret' ,
105
98
});
106
99
107
100
connection .connect (function (err ) {
@@ -125,6 +118,25 @@ appropriate. Any type of connection error (handshake or network) is considered
125
118
a fatal error, see the [ Error Handling] ( #error-handling ) section for more
126
119
information.
127
120
121
+ ## Connection options
122
+
123
+ When establishing a connection, you can set the following options:
124
+
125
+ * ` host ` : The hostname of the database you are connecting to. (Default:
126
+ ` localhost ` )
127
+ * ` port ` : The port number to connect to. (Default: ` 3306 ` )
128
+ * ` socketPath ` : The path to a unix domain socket to connect to. When used ` host `
129
+ and ` port ` are ignored.
130
+ * ` user ` : The MySQL user to authenticate as.
131
+ * ` password ` : The passqword of that MySQL user.
132
+ * ` database ` : Name of the database to use for this connection (Optional).
133
+ * ` charset ` : The charset for the connection. (Default: ` 'UTF8_GENERAL_CI' ` )
134
+ * ` insecureAuth ` : Allow connecting to MySQL instances that ask for the old
135
+ (insecure) authentication method. (Default: ` false ` )
136
+ * ` typeCast ` : Determines if column values should be converted to native
137
+ JavaScript types. (Default: ` true ` )
138
+ * ` debug ` : Prints protocol details to stdout. (Default: ` false ` )
139
+
128
140
## Terminating connections
129
141
130
142
There are two ways to end a connection. Terminating a connection gracefully is
0 commit comments