Improve ConnectionOptions ssl documentation
Opened this issue · 1 comments
I struggled a bit today connecting to an Azure mysql server. I wanted to use TLS, but didn't want to supply certificates manually. (counting on the host's OS to already trust the remote server)
I got it working, but in hindsight I have a couple suggestions to flatten the speed bump and help folks in the future:
- Allow
ssl: true
for people like me that want to turn it on but don't need to customize it - Make it really clear in the tooltip that:
- An empty object
ssl: {}
means "Use SSL". - An absent field (no
ssl:
) means "Don't use SSL".
- An empty object
const db = mysql.createConnection({
host: 'mysql-27b8c77e-devmujahidul-7992.h.aivencloud.com',
port: 17706,
user: 'avnadmin',
password: 'Actual Password', // Replace with your actual password
database: 'defaultdb',
ssl: {}
});
This is my aws mysql connection in mysql2.
I tried with Mysql Workbench and its working very perfectly. But my nodejs application giving so much pain. Always said:
throw err;
^
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 5. Received 9
at boundsError (node:internal/buffer:88:9)
at Buffer.readUInt32LE (node:internal/buffer:222:5)
at Packet.readInt32 (E:\Projects\IPTV WEB\node_modules\mysql2\lib\packets\packet.js:108:24)
at Handshake.fromPacket (E:\Projects\IPTV WEB\node_modules\mysql2\lib\packets\handshake.js:63:32)
at ClientHandshake.handshakeInit (E:\Projects\IPTV WEB\node_modules\mysql2\lib\commands\client_handshake.js:112:40)
at ClientHandshake.execute (E:\Projects\IPTV WEB\node_modules\mysql2\lib\commands\command.js:45:22)
at Connection.handlePacket (E:\Projects\IPTV WEB\node_modules\mysql2\lib\connection.js:481:34)
at PacketParser.onPacket (E:\Projects\IPTV WEB\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (E:\Projects\IPTV WEB\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket. (E:\Projects\IPTV WEB\node_modules\mysql2\lib\connection.js:104:25) {
code: 'ERR_OUT_OF_RANGE',
fatal: true
}
Node.js v20.16.0