You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with this, it exposes you to SQL injection attacks. (Default: `false`)
168
168
*`flags`: List of connection flags to use other than the default ones. It is
169
169
also possible to blacklist default ones. For more information, check [Connection Flags](#connection-flags).
170
-
*`ssl`: object with ssl parameters ( same format as [crypto.createCredentials](http://nodejs.org/api/crypto.html#crypto_crypto_createcredentials_details) argument )
171
-
or a string containing name of ssl profile. Currently only 'Amazon RDS' profile is bundled, containing CA from https://rds.amazonaws.com/doc/rds-ssl-ca-cert.pem
170
+
*`ssl`: object with ssl parameters or a string containing name of ssl profile. See [SSL options](#ssl-options).
172
171
173
172
174
173
In addition to passing these options as an object, you can also use a url
@@ -181,6 +180,28 @@ var connection = mysql.createConnection('mysql://user:pass@host/db?debug=true&ch
181
180
Note: The query values are first attempted to be parsed as JSON, and if that
182
181
fails assumed to be plaintext strings.
183
182
183
+
### SSL options
184
+
185
+
The `ssl` option in the connection options takes a string or an object. When given a string,
186
+
it uses one of the predefined SSL profiles included. The following profiles are included:
187
+
188
+
*`"Amazon RDS"`: this profile is for connecting to an Amazon RDS server and contains the
189
+
ca from https://rds.amazonaws.com/doc/rds-ssl-ca-cert.pem
190
+
191
+
When connecting to other servers, you will need to provide an object of options, in the
192
+
same format as [crypto.createCredentials](http://nodejs.org/api/crypto.html#crypto_crypto_createcredentials_details).
193
+
Please note the arguments expect a string of the certificate, not a file name to the
194
+
certificate. Here is a simple example:
195
+
196
+
```js
197
+
var connection =mysql.createConnection({
198
+
host :'localhost',
199
+
ssl : {
200
+
ca :fs.readFileSync(__dirname+'/mysql-ca.crt')
201
+
}
202
+
});
203
+
```
204
+
184
205
## Terminating connections
185
206
186
207
There are two ways to end a connection. Terminating a connection gracefully is
0 commit comments