mysql2
- Version 3.11.0
- Published
- 503 kB
- 9 dependencies
- MIT license
Install
npm i mysql2
yarn add mysql2
pnpm add mysql2
Overview
fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS
Index
Variables
Functions
Classes
Interfaces
Charsets
- ARMSCII8
- ARMSCII8_BIN
- ARMSCII8_GENERAL_CI
- ASCII
- ASCII_BIN
- ASCII_GENERAL_CI
- BIG5
- BIG5_BIN
- BIG5_CHINESE_CI
- BINARY
- CP1250
- CP1250_BIN
- CP1250_CROATIAN_CI
- CP1250_CZECH_CS
- CP1250_GENERAL_CI
- CP1250_POLISH_CI
- CP1251
- CP1251_BIN
- CP1251_BULGARIAN_CI
- CP1251_GENERAL_CI
- CP1251_GENERAL_CS
- CP1251_UKRAINIAN_CI
- CP1256
- CP1256_BIN
- CP1256_GENERAL_CI
- CP1257
- CP1257_BIN
- CP1257_GENERAL_CI
- CP1257_LITHUANIAN_CI
- CP850
- CP850_BIN
- CP850_GENERAL_CI
- CP852
- CP852_BIN
- CP852_GENERAL_CI
- CP866
- CP866_BIN
- CP866_GENERAL_CI
- CP932
- CP932_BIN
- CP932_JAPANESE_CI
- DEC8
- DEC8_BIN
- DEC8_SWEDISH_CI
- EUCJPMS
- EUCJPMS_BIN
- EUCJPMS_JAPANESE_CI
- EUCKR
- EUCKR_BIN
- EUCKR_KOREAN_CI
- GB18030
- GB18030_BIN
- GB18030_CHINESE_CI
- GB18030_UNICODE_520_CI
- GB2312
- GB2312_BIN
- GB2312_CHINESE_CI
- GBK
- GBK_BIN
- GBK_CHINESE_CI
- GEOSTD8
- GEOSTD8_BIN
- GEOSTD8_GENERAL_CI
- GREEK
- GREEK_BIN
- GREEK_GENERAL_CI
- HEBREW
- HEBREW_BIN
- HEBREW_GENERAL_CI
- HP8
- HP8_BIN
- HP8_ENGLISH_CI
- KEYBCS2
- KEYBCS2_BIN
- KEYBCS2_GENERAL_CI
- KOI8R
- KOI8R_BIN
- KOI8R_GENERAL_CI
- KOI8U
- KOI8U_BIN
- KOI8U_GENERAL_CI
- LATIN1
- LATIN1_BIN
- LATIN1_DANISH_CI
- LATIN1_GENERAL_CI
- LATIN1_GENERAL_CS
- LATIN1_GERMAN1_CI
- LATIN1_GERMAN2_CI
- LATIN1_SPANISH_CI
- LATIN1_SWEDISH_CI
- LATIN2
- LATIN2_BIN
- LATIN2_CROATIAN_CI
- LATIN2_CZECH_CS
- LATIN2_GENERAL_CI
- LATIN2_HUNGARIAN_CI
- LATIN5
- LATIN5_BIN
- LATIN5_TURKISH_CI
- LATIN7
- LATIN7_BIN
- LATIN7_ESTONIAN_CS
- LATIN7_GENERAL_CI
- LATIN7_GENERAL_CS
- MACCE
- MACCE_BIN
- MACCE_GENERAL_CI
- MACROMAN
- MACROMAN_BIN
- MACROMAN_GENERAL_CI
- SJIS
- SJIS_BIN
- SJIS_JAPANESE_CI
- SWE7
- SWE7_BIN
- SWE7_SWEDISH_CI
- TIS620
- TIS620_BIN
- TIS620_THAI_CI
- UCS2
- UCS2_BIN
- UCS2_CROATIAN_CI
- UCS2_CZECH_CI
- UCS2_DANISH_CI
- UCS2_ESPERANTO_CI
- UCS2_ESTONIAN_CI
- UCS2_GENERAL_CI
- UCS2_GENERAL_MYSQL500_CI
- UCS2_GERMAN2_CI
- UCS2_HUNGARIAN_CI
- UCS2_ICELANDIC_CI
- UCS2_LATVIAN_CI
- UCS2_LITHUANIAN_CI
- UCS2_PERSIAN_CI
- UCS2_POLISH_CI
- UCS2_ROMAN_CI
- UCS2_ROMANIAN_CI
- UCS2_SINHALA_CI
- UCS2_SLOVAK_CI
- UCS2_SLOVENIAN_CI
- UCS2_SPANISH_CI
- UCS2_SPANISH2_CI
- UCS2_SWEDISH_CI
- UCS2_TURKISH_CI
- UCS2_UNICODE_520_CI
- UCS2_UNICODE_CI
- UCS2_VIETNAMESE_CI
- UJIS
- UJIS_BIN
- UJIS_JAPANESE_CI
- UTF16
- UTF16_BIN
- UTF16_CROATIAN_CI
- UTF16_CZECH_CI
- UTF16_DANISH_CI
- UTF16_ESPERANTO_CI
- UTF16_ESTONIAN_CI
- UTF16_GENERAL_CI
- UTF16_GERMAN2_CI
- UTF16_HUNGARIAN_CI
- UTF16_ICELANDIC_CI
- UTF16_LATVIAN_CI
- UTF16_LITHUANIAN_CI
- UTF16_PERSIAN_CI
- UTF16_POLISH_CI
- UTF16_ROMAN_CI
- UTF16_ROMANIAN_CI
- UTF16_SINHALA_CI
- UTF16_SLOVAK_CI
- UTF16_SLOVENIAN_CI
- UTF16_SPANISH_CI
- UTF16_SPANISH2_CI
- UTF16_SWEDISH_CI
- UTF16_TURKISH_CI
- UTF16_UNICODE_520_CI
- UTF16_UNICODE_CI
- UTF16_VIETNAMESE_CI
- UTF16LE
- UTF16LE_BIN
- UTF16LE_GENERAL_CI
- UTF32
- UTF32_BIN
- UTF32_CROATIAN_CI
- UTF32_CZECH_CI
- UTF32_DANISH_CI
- UTF32_ESPERANTO_CI
- UTF32_ESTONIAN_CI
- UTF32_GENERAL_CI
- UTF32_GERMAN2_CI
- UTF32_HUNGARIAN_CI
- UTF32_ICELANDIC_CI
- UTF32_LATVIAN_CI
- UTF32_LITHUANIAN_CI
- UTF32_PERSIAN_CI
- UTF32_POLISH_CI
- UTF32_ROMAN_CI
- UTF32_ROMANIAN_CI
- UTF32_SINHALA_CI
- UTF32_SLOVAK_CI
- UTF32_SLOVENIAN_CI
- UTF32_SPANISH_CI
- UTF32_SPANISH2_CI
- UTF32_SWEDISH_CI
- UTF32_TURKISH_CI
- UTF32_UNICODE_520_CI
- UTF32_UNICODE_CI
- UTF32_VIETNAMESE_CI
- UTF8
- UTF8_BIN
- UTF8_CROATIAN_CI
- UTF8_CZECH_CI
- UTF8_DANISH_CI
- UTF8_ESPERANTO_CI
- UTF8_ESTONIAN_CI
- UTF8_GENERAL_CI
- UTF8_GENERAL_MYSQL500_CI
- UTF8_GENERAL50_CI
- UTF8_GERMAN2_CI
- UTF8_HUNGARIAN_CI
- UTF8_ICELANDIC_CI
- UTF8_LATVIAN_CI
- UTF8_LITHUANIAN_CI
- UTF8_PERSIAN_CI
- UTF8_POLISH_CI
- UTF8_ROMAN_CI
- UTF8_ROMANIAN_CI
- UTF8_SINHALA_CI
- UTF8_SLOVAK_CI
- UTF8_SLOVENIAN_CI
- UTF8_SPANISH_CI
- UTF8_SPANISH2_CI
- UTF8_SWEDISH_CI
- UTF8_TOLOWER_CI
- UTF8_TURKISH_CI
- UTF8_UNICODE_520_CI
- UTF8_UNICODE_CI
- UTF8_VIETNAMESE_CI
- UTF8MB4
- UTF8MB4_0900_AI_CI
- UTF8MB4_0900_AS_CI
- UTF8MB4_0900_AS_CS
- UTF8MB4_0900_BIN
- UTF8MB4_BIN
- UTF8MB4_CROATIAN_CI
- UTF8MB4_CS_0900_AI_CI
- UTF8MB4_CS_0900_AS_CS
- UTF8MB4_CZECH_CI
- UTF8MB4_DA_0900_AI_CI
- UTF8MB4_DA_0900_AS_CS
- UTF8MB4_DANISH_CI
- UTF8MB4_DE_PB_0900_AI_CI
- UTF8MB4_DE_PB_0900_AS_CS
- UTF8MB4_EO_0900_AI_CI
- UTF8MB4_EO_0900_AS_CS
- UTF8MB4_ES_0900_AI_CI
- UTF8MB4_ES_0900_AS_CS
- UTF8MB4_ES_TRAD_0900_AI_CI
- UTF8MB4_ES_TRAD_0900_AS_CS
- UTF8MB4_ESPERANTO_CI
- UTF8MB4_ESTONIAN_CI
- UTF8MB4_ET_0900_AI_CI
- UTF8MB4_ET_0900_AS_CS
- UTF8MB4_GENERAL_CI
- UTF8MB4_GERMAN2_CI
- UTF8MB4_HR_0900_AI_CI
- UTF8MB4_HR_0900_AS_CS
- UTF8MB4_HU_0900_AI_CI
- UTF8MB4_HU_0900_AS_CS
- UTF8MB4_HUNGARIAN_CI
- UTF8MB4_ICELANDIC_CI
- UTF8MB4_IS_0900_AI_CI
- UTF8MB4_IS_0900_AS_CS
- UTF8MB4_JA_0900_AS_CS
- UTF8MB4_JA_0900_AS_CS_KS
- UTF8MB4_LA_0900_AI_CI
- UTF8MB4_LA_0900_AS_CS
- UTF8MB4_LATVIAN_CI
- UTF8MB4_LITHUANIAN_CI
- UTF8MB4_LT_0900_AI_CI
- UTF8MB4_LT_0900_AS_CS
- UTF8MB4_LV_0900_AI_CI
- UTF8MB4_LV_0900_AS_CS
- UTF8MB4_PERSIAN_CI
- UTF8MB4_PL_0900_AI_CI
- UTF8MB4_PL_0900_AS_CS
- UTF8MB4_POLISH_CI
- UTF8MB4_RO_0900_AI_CI
- UTF8MB4_RO_0900_AS_CS
- UTF8MB4_ROMAN_CI
- UTF8MB4_ROMANIAN_CI
- UTF8MB4_RU_0900_AI_CI
- UTF8MB4_RU_0900_AS_CS
- UTF8MB4_SINHALA_CI
- UTF8MB4_SK_0900_AI_CI
- UTF8MB4_SK_0900_AS_CS
- UTF8MB4_SL_0900_AI_CI
- UTF8MB4_SL_0900_AS_CS
- UTF8MB4_SLOVAK_CI
- UTF8MB4_SLOVENIAN_CI
- UTF8MB4_SPANISH_CI
- UTF8MB4_SPANISH2_CI
- UTF8MB4_SV_0900_AI_CI
- UTF8MB4_SV_0900_AS_CS
- UTF8MB4_SWEDISH_CI
- UTF8MB4_TR_0900_AI_CI
- UTF8MB4_TR_0900_AS_CS
- UTF8MB4_TURKISH_CI
- UTF8MB4_UNICODE_520_CI
- UTF8MB4_UNICODE_CI
- UTF8MB4_VI_0900_AI_CI
- UTF8MB4_VI_0900_AS_CS
- UTF8MB4_VIETNAMESE_CI
- UTF8MB4_ZH_0900_AS_CS
ConnectionOptions
- authPlugins
- authSwitchHandler
- bigNumberStrings
- charset
- charsetNumber
- compress
- connectAttributes
- connectionLimit
- connectTimeout
- database
- dateStrings
- debug
- decimalNumbers
- enableKeepAlive
- flags
- host
- idleTimeout
- infileStreamFactory
- insecureAuth
- isServer
- jsonStrings
- keepAliveInitialDelay
- localAddress
- maxIdle
- maxPreparedStatements
- multipleStatements
- namedPlaceholders
- nestTables
- password
- password1
- password2
- password3
- passwordSha1
- pool
- port
- Promise
- queryFormat
- queueLimit
- rowsAsArray
- socketPath
- ssl
- stream
- stringifyObjects
- supportBigNumbers
- timezone
- trace
- typeCast
- uri
- user
- waitForConnections
Type Aliases
Variables
variable authPlugins
const authPlugins: { caching_sha2_password: AuthPluginDefinition<{ overrideIsSecure?: boolean; serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike; onServerPublicKey?: (data: Buffer) => void; }>; mysql_clear_password: AuthPluginDefinition<{ password?: string }>; mysql_native_password: AuthPluginDefinition<{ password?: string; passwordSha1?: string; }>; sha256_password: AuthPluginDefinition<{ serverPublicKey?: RsaPublicKey | RsaPrivateKey | KeyLike; onServerPublicKey?: (data: Buffer) => void; }>;};
variable Charsets
const Charsets: Charsets;
Constant
Charsets
.Please note that
Charsets
can only be accessed from themysql
object and not imported directly.
variable CharsetToEncoding
const CharsetToEncoding: string[];
Constant
CharsetToEncoding
.Please note that
CharsetToEncoding
can only be accessed from themysql
object and not imported directly.
variable Types
const Types: Types;
Constant
Types
.Please note that
Types
can only be accessed from themysql
object and not imported directly.
Functions
function clearParserCache
clearParserCache: () => void;
function createConnection
createConnection: { (connectionUri: string): BaseConnection; (config: ConnectionOptions): BaseConnection;};
function createPool
createPool: { (connectionUri: string): BasePool; (config: PoolOptions): BasePool;};
function createPoolCluster
createPoolCluster: (config?: PoolClusterOptions) => PoolCluster;
function createServer
createServer: (handler: (conn: BaseConnection) => any) => Server;
function escape
escape: (value: any) => string;
function escapeId
escapeId: (value: any) => string;
function format
format: { (sql: string): string; ( sql: string, values: any[], stringifyObjects?: boolean, timeZone?: string ): string; ( sql: string, values: any, stringifyObjects?: boolean, timeZone?: string ): string;};
function raw
raw: (sql: string) => { toSqlString: () => string };
function setMaxParserCache
setMaxParserCache: (max: number) => void;
Classes
class PrepareStatementInfo
class PrepareStatementInfo {}
Interfaces
interface Charsets
interface Charsets {}
property ARMSCII8
ARMSCII8: number;
property ARMSCII8_BIN
ARMSCII8_BIN: number;
property ARMSCII8_GENERAL_CI
ARMSCII8_GENERAL_CI: number;
property ASCII
ASCII: number;
property ASCII_BIN
ASCII_BIN: number;
property ASCII_GENERAL_CI
ASCII_GENERAL_CI: number;
property BIG5
BIG5: number;
property BIG5_BIN
BIG5_BIN: number;
property BIG5_CHINESE_CI
BIG5_CHINESE_CI: number;
property BINARY
BINARY: number;
property CP1250
CP1250: number;
property CP1250_BIN
CP1250_BIN: number;
property CP1250_CROATIAN_CI
CP1250_CROATIAN_CI: number;
property CP1250_CZECH_CS
CP1250_CZECH_CS: number;
property CP1250_GENERAL_CI
CP1250_GENERAL_CI: number;
property CP1250_POLISH_CI
CP1250_POLISH_CI: number;
property CP1251
CP1251: number;
property CP1251_BIN
CP1251_BIN: number;
property CP1251_BULGARIAN_CI
CP1251_BULGARIAN_CI: number;
property CP1251_GENERAL_CI
CP1251_GENERAL_CI: number;
property CP1251_GENERAL_CS
CP1251_GENERAL_CS: number;
property CP1251_UKRAINIAN_CI
CP1251_UKRAINIAN_CI: number;
property CP1256
CP1256: number;
property CP1256_BIN
CP1256_BIN: number;
property CP1256_GENERAL_CI
CP1256_GENERAL_CI: number;
property CP1257
CP1257: number;
property CP1257_BIN
CP1257_BIN: number;
property CP1257_GENERAL_CI
CP1257_GENERAL_CI: number;
property CP1257_LITHUANIAN_CI
CP1257_LITHUANIAN_CI: number;
property CP850
CP850: number;
property CP850_BIN
CP850_BIN: number;
property CP850_GENERAL_CI
CP850_GENERAL_CI: number;
property CP852
CP852: number;
property CP852_BIN
CP852_BIN: number;
property CP852_GENERAL_CI
CP852_GENERAL_CI: number;
property CP866
CP866: number;
property CP866_BIN
CP866_BIN: number;
property CP866_GENERAL_CI
CP866_GENERAL_CI: number;
property CP932
CP932: number;
property CP932_BIN
CP932_BIN: number;
property CP932_JAPANESE_CI
CP932_JAPANESE_CI: number;
property DEC8
DEC8: number;
property DEC8_BIN
DEC8_BIN: number;
property DEC8_SWEDISH_CI
DEC8_SWEDISH_CI: number;
property EUCJPMS
EUCJPMS: number;
property EUCJPMS_BIN
EUCJPMS_BIN: number;
property EUCJPMS_JAPANESE_CI
EUCJPMS_JAPANESE_CI: number;
property EUCKR
EUCKR: number;
property EUCKR_BIN
EUCKR_BIN: number;
property EUCKR_KOREAN_CI
EUCKR_KOREAN_CI: number;
property GB18030
GB18030: number;
property GB18030_BIN
GB18030_BIN: number;
property GB18030_CHINESE_CI
GB18030_CHINESE_CI: number;
property GB18030_UNICODE_520_CI
GB18030_UNICODE_520_CI: number;
property GB2312
GB2312: number;
property GB2312_BIN
GB2312_BIN: number;
property GB2312_CHINESE_CI
GB2312_CHINESE_CI: number;
property GBK
GBK: number;
property GBK_BIN
GBK_BIN: number;
property GBK_CHINESE_CI
GBK_CHINESE_CI: number;
property GEOSTD8
GEOSTD8: number;
property GEOSTD8_BIN
GEOSTD8_BIN: number;
property GEOSTD8_GENERAL_CI
GEOSTD8_GENERAL_CI: number;
property GREEK
GREEK: number;
property GREEK_BIN
GREEK_BIN: number;
property GREEK_GENERAL_CI
GREEK_GENERAL_CI: number;
property HEBREW
HEBREW: number;
property HEBREW_BIN
HEBREW_BIN: number;
property HEBREW_GENERAL_CI
HEBREW_GENERAL_CI: number;
property HP8
HP8: number;
property HP8_BIN
HP8_BIN: number;
property HP8_ENGLISH_CI
HP8_ENGLISH_CI: number;
property KEYBCS2
KEYBCS2: number;
property KEYBCS2_BIN
KEYBCS2_BIN: number;
property KEYBCS2_GENERAL_CI
KEYBCS2_GENERAL_CI: number;
property KOI8R
KOI8R: number;
property KOI8R_BIN
KOI8R_BIN: number;
property KOI8R_GENERAL_CI
KOI8R_GENERAL_CI: number;
property KOI8U
KOI8U: number;
property KOI8U_BIN
KOI8U_BIN: number;
property KOI8U_GENERAL_CI
KOI8U_GENERAL_CI: number;
property LATIN1
LATIN1: number;
property LATIN1_BIN
LATIN1_BIN: number;
property LATIN1_DANISH_CI
LATIN1_DANISH_CI: number;
property LATIN1_GENERAL_CI
LATIN1_GENERAL_CI: number;
property LATIN1_GENERAL_CS
LATIN1_GENERAL_CS: number;
property LATIN1_GERMAN1_CI
LATIN1_GERMAN1_CI: number;
property LATIN1_GERMAN2_CI
LATIN1_GERMAN2_CI: number;
property LATIN1_SPANISH_CI
LATIN1_SPANISH_CI: number;
property LATIN1_SWEDISH_CI
LATIN1_SWEDISH_CI: number;
property LATIN2
LATIN2: number;
property LATIN2_BIN
LATIN2_BIN: number;
property LATIN2_CROATIAN_CI
LATIN2_CROATIAN_CI: number;
property LATIN2_CZECH_CS
LATIN2_CZECH_CS: number;
property LATIN2_GENERAL_CI
LATIN2_GENERAL_CI: number;
property LATIN2_HUNGARIAN_CI
LATIN2_HUNGARIAN_CI: number;
property LATIN5
LATIN5: number;
property LATIN5_BIN
LATIN5_BIN: number;
property LATIN5_TURKISH_CI
LATIN5_TURKISH_CI: number;
property LATIN7
LATIN7: number;
property LATIN7_BIN
LATIN7_BIN: number;
property LATIN7_ESTONIAN_CS
LATIN7_ESTONIAN_CS: number;
property LATIN7_GENERAL_CI
LATIN7_GENERAL_CI: number;
property LATIN7_GENERAL_CS
LATIN7_GENERAL_CS: number;
property MACCE
MACCE: number;
property MACCE_BIN
MACCE_BIN: number;
property MACCE_GENERAL_CI
MACCE_GENERAL_CI: number;
property MACROMAN
MACROMAN: number;
property MACROMAN_BIN
MACROMAN_BIN: number;
property MACROMAN_GENERAL_CI
MACROMAN_GENERAL_CI: number;
property SJIS
SJIS: number;
property SJIS_BIN
SJIS_BIN: number;
property SJIS_JAPANESE_CI
SJIS_JAPANESE_CI: number;
property SWE7
SWE7: number;
property SWE7_BIN
SWE7_BIN: number;
property SWE7_SWEDISH_CI
SWE7_SWEDISH_CI: number;
property TIS620
TIS620: number;
property TIS620_BIN
TIS620_BIN: number;
property TIS620_THAI_CI
TIS620_THAI_CI: number;
property UCS2
UCS2: number;
property UCS2_BIN
UCS2_BIN: number;
property UCS2_CROATIAN_CI
UCS2_CROATIAN_CI: number;
property UCS2_CZECH_CI
UCS2_CZECH_CI: number;
property UCS2_DANISH_CI
UCS2_DANISH_CI: number;
property UCS2_ESPERANTO_CI
UCS2_ESPERANTO_CI: number;
property UCS2_ESTONIAN_CI
UCS2_ESTONIAN_CI: number;
property UCS2_GENERAL_CI
UCS2_GENERAL_CI: number;
property UCS2_GENERAL_MYSQL500_CI
UCS2_GENERAL_MYSQL500_CI: number;
property UCS2_GERMAN2_CI
UCS2_GERMAN2_CI: number;
property UCS2_HUNGARIAN_CI
UCS2_HUNGARIAN_CI: number;
property UCS2_ICELANDIC_CI
UCS2_ICELANDIC_CI: number;
property UCS2_LATVIAN_CI
UCS2_LATVIAN_CI: number;
property UCS2_LITHUANIAN_CI
UCS2_LITHUANIAN_CI: number;
property UCS2_PERSIAN_CI
UCS2_PERSIAN_CI: number;
property UCS2_POLISH_CI
UCS2_POLISH_CI: number;
property UCS2_ROMAN_CI
UCS2_ROMAN_CI: number;
property UCS2_ROMANIAN_CI
UCS2_ROMANIAN_CI: number;
property UCS2_SINHALA_CI
UCS2_SINHALA_CI: number;
property UCS2_SLOVAK_CI
UCS2_SLOVAK_CI: number;
property UCS2_SLOVENIAN_CI
UCS2_SLOVENIAN_CI: number;
property UCS2_SPANISH_CI
UCS2_SPANISH_CI: number;
property UCS2_SPANISH2_CI
UCS2_SPANISH2_CI: number;
property UCS2_SWEDISH_CI
UCS2_SWEDISH_CI: number;
property UCS2_TURKISH_CI
UCS2_TURKISH_CI: number;
property UCS2_UNICODE_520_CI
UCS2_UNICODE_520_CI: number;
property UCS2_UNICODE_CI
UCS2_UNICODE_CI: number;
property UCS2_VIETNAMESE_CI
UCS2_VIETNAMESE_CI: number;
property UJIS
UJIS: number;
property UJIS_BIN
UJIS_BIN: number;
property UJIS_JAPANESE_CI
UJIS_JAPANESE_CI: number;
property UTF16
UTF16: number;
property UTF16_BIN
UTF16_BIN: number;
property UTF16_CROATIAN_CI
UTF16_CROATIAN_CI: number;
property UTF16_CZECH_CI
UTF16_CZECH_CI: number;
property UTF16_DANISH_CI
UTF16_DANISH_CI: number;
property UTF16_ESPERANTO_CI
UTF16_ESPERANTO_CI: number;
property UTF16_ESTONIAN_CI
UTF16_ESTONIAN_CI: number;
property UTF16_GENERAL_CI
UTF16_GENERAL_CI: number;
property UTF16_GERMAN2_CI
UTF16_GERMAN2_CI: number;
property UTF16_HUNGARIAN_CI
UTF16_HUNGARIAN_CI: number;
property UTF16_ICELANDIC_CI
UTF16_ICELANDIC_CI: number;
property UTF16_LATVIAN_CI
UTF16_LATVIAN_CI: number;
property UTF16_LITHUANIAN_CI
UTF16_LITHUANIAN_CI: number;
property UTF16_PERSIAN_CI
UTF16_PERSIAN_CI: number;
property UTF16_POLISH_CI
UTF16_POLISH_CI: number;
property UTF16_ROMAN_CI
UTF16_ROMAN_CI: number;
property UTF16_ROMANIAN_CI
UTF16_ROMANIAN_CI: number;
property UTF16_SINHALA_CI
UTF16_SINHALA_CI: number;
property UTF16_SLOVAK_CI
UTF16_SLOVAK_CI: number;
property UTF16_SLOVENIAN_CI
UTF16_SLOVENIAN_CI: number;
property UTF16_SPANISH_CI
UTF16_SPANISH_CI: number;
property UTF16_SPANISH2_CI
UTF16_SPANISH2_CI: number;
property UTF16_SWEDISH_CI
UTF16_SWEDISH_CI: number;
property UTF16_TURKISH_CI
UTF16_TURKISH_CI: number;
property UTF16_UNICODE_520_CI
UTF16_UNICODE_520_CI: number;
property UTF16_UNICODE_CI
UTF16_UNICODE_CI: number;
property UTF16_VIETNAMESE_CI
UTF16_VIETNAMESE_CI: number;
property UTF16LE
UTF16LE: number;
property UTF16LE_BIN
UTF16LE_BIN: number;
property UTF16LE_GENERAL_CI
UTF16LE_GENERAL_CI: number;
property UTF32
UTF32: number;
property UTF32_BIN
UTF32_BIN: number;
property UTF32_CROATIAN_CI
UTF32_CROATIAN_CI: number;
property UTF32_CZECH_CI
UTF32_CZECH_CI: number;
property UTF32_DANISH_CI
UTF32_DANISH_CI: number;
property UTF32_ESPERANTO_CI
UTF32_ESPERANTO_CI: number;
property UTF32_ESTONIAN_CI
UTF32_ESTONIAN_CI: number;
property UTF32_GENERAL_CI
UTF32_GENERAL_CI: number;
property UTF32_GERMAN2_CI
UTF32_GERMAN2_CI: number;
property UTF32_HUNGARIAN_CI
UTF32_HUNGARIAN_CI: number;
property UTF32_ICELANDIC_CI
UTF32_ICELANDIC_CI: number;
property UTF32_LATVIAN_CI
UTF32_LATVIAN_CI: number;
property UTF32_LITHUANIAN_CI
UTF32_LITHUANIAN_CI: number;
property UTF32_PERSIAN_CI
UTF32_PERSIAN_CI: number;
property UTF32_POLISH_CI
UTF32_POLISH_CI: number;
property UTF32_ROMAN_CI
UTF32_ROMAN_CI: number;
property UTF32_ROMANIAN_CI
UTF32_ROMANIAN_CI: number;
property UTF32_SINHALA_CI
UTF32_SINHALA_CI: number;
property UTF32_SLOVAK_CI
UTF32_SLOVAK_CI: number;
property UTF32_SLOVENIAN_CI
UTF32_SLOVENIAN_CI: number;
property UTF32_SPANISH_CI
UTF32_SPANISH_CI: number;
property UTF32_SPANISH2_CI
UTF32_SPANISH2_CI: number;
property UTF32_SWEDISH_CI
UTF32_SWEDISH_CI: number;
property UTF32_TURKISH_CI
UTF32_TURKISH_CI: number;
property UTF32_UNICODE_520_CI
UTF32_UNICODE_520_CI: number;
property UTF32_UNICODE_CI
UTF32_UNICODE_CI: number;
property UTF32_VIETNAMESE_CI
UTF32_VIETNAMESE_CI: number;
property UTF8
UTF8: number;
property UTF8_BIN
UTF8_BIN: number;
property UTF8_CROATIAN_CI
UTF8_CROATIAN_CI: number;
property UTF8_CZECH_CI
UTF8_CZECH_CI: number;
property UTF8_DANISH_CI
UTF8_DANISH_CI: number;
property UTF8_ESPERANTO_CI
UTF8_ESPERANTO_CI: number;
property UTF8_ESTONIAN_CI
UTF8_ESTONIAN_CI: number;
property UTF8_GENERAL_CI
UTF8_GENERAL_CI: number;
property UTF8_GENERAL_MYSQL500_CI
UTF8_GENERAL_MYSQL500_CI: number;
property UTF8_GENERAL50_CI
UTF8_GENERAL50_CI: number;
Deprecated
property UTF8_GERMAN2_CI
UTF8_GERMAN2_CI: number;
property UTF8_HUNGARIAN_CI
UTF8_HUNGARIAN_CI: number;
property UTF8_ICELANDIC_CI
UTF8_ICELANDIC_CI: number;
property UTF8_LATVIAN_CI
UTF8_LATVIAN_CI: number;
property UTF8_LITHUANIAN_CI
UTF8_LITHUANIAN_CI: number;
property UTF8_PERSIAN_CI
UTF8_PERSIAN_CI: number;
property UTF8_POLISH_CI
UTF8_POLISH_CI: number;
property UTF8_ROMAN_CI
UTF8_ROMAN_CI: number;
property UTF8_ROMANIAN_CI
UTF8_ROMANIAN_CI: number;
property UTF8_SINHALA_CI
UTF8_SINHALA_CI: number;
property UTF8_SLOVAK_CI
UTF8_SLOVAK_CI: number;
property UTF8_SLOVENIAN_CI
UTF8_SLOVENIAN_CI: number;
property UTF8_SPANISH_CI
UTF8_SPANISH_CI: number;
property UTF8_SPANISH2_CI
UTF8_SPANISH2_CI: number;
property UTF8_SWEDISH_CI
UTF8_SWEDISH_CI: number;
property UTF8_TOLOWER_CI
UTF8_TOLOWER_CI: number;
property UTF8_TURKISH_CI
UTF8_TURKISH_CI: number;
property UTF8_UNICODE_520_CI
UTF8_UNICODE_520_CI: number;
property UTF8_UNICODE_CI
UTF8_UNICODE_CI: number;
property UTF8_VIETNAMESE_CI
UTF8_VIETNAMESE_CI: number;
property UTF8MB4
UTF8MB4: number;
property UTF8MB4_0900_AI_CI
UTF8MB4_0900_AI_CI: number;
property UTF8MB4_0900_AS_CI
UTF8MB4_0900_AS_CI: number;
property UTF8MB4_0900_AS_CS
UTF8MB4_0900_AS_CS: number;
property UTF8MB4_0900_BIN
UTF8MB4_0900_BIN: number;
property UTF8MB4_BIN
UTF8MB4_BIN: number;
property UTF8MB4_CROATIAN_CI
UTF8MB4_CROATIAN_CI: number;
property UTF8MB4_CS_0900_AI_CI
UTF8MB4_CS_0900_AI_CI: number;
property UTF8MB4_CS_0900_AS_CS
UTF8MB4_CS_0900_AS_CS: number;
property UTF8MB4_CZECH_CI
UTF8MB4_CZECH_CI: number;
property UTF8MB4_DA_0900_AI_CI
UTF8MB4_DA_0900_AI_CI: number;
property UTF8MB4_DA_0900_AS_CS
UTF8MB4_DA_0900_AS_CS: number;
property UTF8MB4_DANISH_CI
UTF8MB4_DANISH_CI: number;
property UTF8MB4_DE_PB_0900_AI_CI
UTF8MB4_DE_PB_0900_AI_CI: number;
property UTF8MB4_DE_PB_0900_AS_CS
UTF8MB4_DE_PB_0900_AS_CS: number;
property UTF8MB4_EO_0900_AI_CI
UTF8MB4_EO_0900_AI_CI: number;
property UTF8MB4_EO_0900_AS_CS
UTF8MB4_EO_0900_AS_CS: number;
property UTF8MB4_ES_0900_AI_CI
UTF8MB4_ES_0900_AI_CI: number;
property UTF8MB4_ES_0900_AS_CS
UTF8MB4_ES_0900_AS_CS: number;
property UTF8MB4_ES_TRAD_0900_AI_CI
UTF8MB4_ES_TRAD_0900_AI_CI: number;
property UTF8MB4_ES_TRAD_0900_AS_CS
UTF8MB4_ES_TRAD_0900_AS_CS: number;
property UTF8MB4_ESPERANTO_CI
UTF8MB4_ESPERANTO_CI: number;
property UTF8MB4_ESTONIAN_CI
UTF8MB4_ESTONIAN_CI: number;
property UTF8MB4_ET_0900_AI_CI
UTF8MB4_ET_0900_AI_CI: number;
property UTF8MB4_ET_0900_AS_CS
UTF8MB4_ET_0900_AS_CS: number;
property UTF8MB4_GENERAL_CI
UTF8MB4_GENERAL_CI: number;
property UTF8MB4_GERMAN2_CI
UTF8MB4_GERMAN2_CI: number;
property UTF8MB4_HR_0900_AI_CI
UTF8MB4_HR_0900_AI_CI: number;
property UTF8MB4_HR_0900_AS_CS
UTF8MB4_HR_0900_AS_CS: number;
property UTF8MB4_HU_0900_AI_CI
UTF8MB4_HU_0900_AI_CI: number;
property UTF8MB4_HU_0900_AS_CS
UTF8MB4_HU_0900_AS_CS: number;
property UTF8MB4_HUNGARIAN_CI
UTF8MB4_HUNGARIAN_CI: number;
property UTF8MB4_ICELANDIC_CI
UTF8MB4_ICELANDIC_CI: number;
property UTF8MB4_IS_0900_AI_CI
UTF8MB4_IS_0900_AI_CI: number;
property UTF8MB4_IS_0900_AS_CS
UTF8MB4_IS_0900_AS_CS: number;
property UTF8MB4_JA_0900_AS_CS
UTF8MB4_JA_0900_AS_CS: number;
property UTF8MB4_JA_0900_AS_CS_KS
UTF8MB4_JA_0900_AS_CS_KS: number;
property UTF8MB4_LA_0900_AI_CI
UTF8MB4_LA_0900_AI_CI: number;
property UTF8MB4_LA_0900_AS_CS
UTF8MB4_LA_0900_AS_CS: number;
property UTF8MB4_LATVIAN_CI
UTF8MB4_LATVIAN_CI: number;
property UTF8MB4_LITHUANIAN_CI
UTF8MB4_LITHUANIAN_CI: number;
property UTF8MB4_LT_0900_AI_CI
UTF8MB4_LT_0900_AI_CI: number;
property UTF8MB4_LT_0900_AS_CS
UTF8MB4_LT_0900_AS_CS: number;
property UTF8MB4_LV_0900_AI_CI
UTF8MB4_LV_0900_AI_CI: number;
property UTF8MB4_LV_0900_AS_CS
UTF8MB4_LV_0900_AS_CS: number;
property UTF8MB4_PERSIAN_CI
UTF8MB4_PERSIAN_CI: number;
property UTF8MB4_PL_0900_AI_CI
UTF8MB4_PL_0900_AI_CI: number;
property UTF8MB4_PL_0900_AS_CS
UTF8MB4_PL_0900_AS_CS: number;
property UTF8MB4_POLISH_CI
UTF8MB4_POLISH_CI: number;
property UTF8MB4_RO_0900_AI_CI
UTF8MB4_RO_0900_AI_CI: number;
property UTF8MB4_RO_0900_AS_CS
UTF8MB4_RO_0900_AS_CS: number;
property UTF8MB4_ROMAN_CI
UTF8MB4_ROMAN_CI: number;
property UTF8MB4_ROMANIAN_CI
UTF8MB4_ROMANIAN_CI: number;
property UTF8MB4_RU_0900_AI_CI
UTF8MB4_RU_0900_AI_CI: number;
property UTF8MB4_RU_0900_AS_CS
UTF8MB4_RU_0900_AS_CS: number;
property UTF8MB4_SINHALA_CI
UTF8MB4_SINHALA_CI: number;
property UTF8MB4_SK_0900_AI_CI
UTF8MB4_SK_0900_AI_CI: number;
property UTF8MB4_SK_0900_AS_CS
UTF8MB4_SK_0900_AS_CS: number;
property UTF8MB4_SL_0900_AI_CI
UTF8MB4_SL_0900_AI_CI: number;
property UTF8MB4_SL_0900_AS_CS
UTF8MB4_SL_0900_AS_CS: number;
property UTF8MB4_SLOVAK_CI
UTF8MB4_SLOVAK_CI: number;
property UTF8MB4_SLOVENIAN_CI
UTF8MB4_SLOVENIAN_CI: number;
property UTF8MB4_SPANISH_CI
UTF8MB4_SPANISH_CI: number;
property UTF8MB4_SPANISH2_CI
UTF8MB4_SPANISH2_CI: number;
property UTF8MB4_SV_0900_AI_CI
UTF8MB4_SV_0900_AI_CI: number;
property UTF8MB4_SV_0900_AS_CS
UTF8MB4_SV_0900_AS_CS: number;
property UTF8MB4_SWEDISH_CI
UTF8MB4_SWEDISH_CI: number;
property UTF8MB4_TR_0900_AI_CI
UTF8MB4_TR_0900_AI_CI: number;
property UTF8MB4_TR_0900_AS_CS
UTF8MB4_TR_0900_AS_CS: number;
property UTF8MB4_TURKISH_CI
UTF8MB4_TURKISH_CI: number;
property UTF8MB4_UNICODE_520_CI
UTF8MB4_UNICODE_520_CI: number;
property UTF8MB4_UNICODE_CI
UTF8MB4_UNICODE_CI: number;
property UTF8MB4_VI_0900_AI_CI
UTF8MB4_VI_0900_AI_CI: number;
property UTF8MB4_VI_0900_AS_CS
UTF8MB4_VI_0900_AS_CS: number;
property UTF8MB4_VIETNAMESE_CI
UTF8MB4_VIETNAMESE_CI: number;
property UTF8MB4_ZH_0900_AS_CS
UTF8MB4_ZH_0900_AS_CS: number;
interface Connection
interface Connection extends BaseConnection {}
interface ConnectionConfig
interface ConnectionConfig extends ConnectionOptions {}
method getCharsetNumber
getCharsetNumber: (charset: string) => number;
method getDefaultFlags
getDefaultFlags: (options?: ConnectionOptions) => string[];
method getSSLProfile
getSSLProfile: (name: string) => { ca: string[] };
method mergeFlags
mergeFlags: (defaultFlags: string[], userFlags: string[] | string) => number;
method parseUrl
parseUrl: (url: string) => { [key: string]: any; host: string; port: number; database: string; user: string; password: string;};
interface ConnectionOptions
interface ConnectionOptions {}
property authPlugins
authPlugins?: { [key: string]: AuthPlugin;};
property authSwitchHandler
authSwitchHandler?: (data: any, callback: () => void) => any;
property bigNumberStrings
bigNumberStrings?: boolean;
Enabling both supportBigNumbers and bigNumberStrings forces big numbers (BIGINT and DECIMAL columns) to be always returned as JavaScript String objects (Default: false). Enabling supportBigNumbers but leaving bigNumberStrings disabled will return big numbers as String objects only when they cannot be accurately represented with [JavaScript Number objects](https://262.ecma-international.org/5.1/#sec-8.5) (which happens when they exceed the [-2^53, +2^53] range), otherwise they will be returned as Number objects. This option is ignored if supportBigNumbers is disabled.
property charset
charset?: string;
The charset for the connection. This is called 'collation' in the SQL-level of MySQL (like utf8_general_ci). If a SQL-level charset is specified (like utf8mb4) then the default collation for that charset is used. (Default: 'UTF8_GENERAL_CI')
property charsetNumber
charsetNumber?: number;
property compress
compress?: boolean;
property connectAttributes
connectAttributes?: { [param: string]: any };
property connectionLimit
connectionLimit?: number;
property connectTimeout
connectTimeout?: number;
The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10 seconds)
property database
database?: string;
Name of the database to use for this connection
property dateStrings
dateStrings?: boolean | Array<'TIMESTAMP' | 'DATETIME' | 'DATE'>;
Force date types (TIMESTAMP, DATETIME, DATE) to be returned as strings rather then inflated into JavaScript Date objects. Can be true/false or an array of type names to keep as strings.
(Default: false)
property debug
debug?: any;
This will print all incoming and outgoing packets on stdout. You can also restrict debugging to packet types by passing an array of types (strings) to debug;
(Default: false)
property decimalNumbers
decimalNumbers?: boolean;
DECIMAL and NEWDECIMAL types will be returned as numbers if this option is set to
true
( default:false
).
property enableKeepAlive
enableKeepAlive?: boolean;
Enable keep-alive on the socket. (Default: true)
property flags
flags?: Array<string>;
List of connection flags to use other than the default ones. It is also possible to blacklist default ones
property host
host?: string;
The hostname of the database you are connecting to. (Default: localhost)
property idleTimeout
idleTimeout?: number;
property infileStreamFactory
infileStreamFactory?: (path: string) => Readable;
By specifying a function that returns a readable stream, an arbitrary stream can be sent when sending a local fs file.
property insecureAuth
insecureAuth?: boolean;
Allow connecting to MySQL instances that ask for the old (insecure) authentication method. (Default: false)
property isServer
isServer?: boolean;
property jsonStrings
jsonStrings?: boolean;
Force JSON to be returned as string
(Default: false)
property keepAliveInitialDelay
keepAliveInitialDelay?: number;
If keep-alive is enabled users can supply an initial delay. (Default: 0)
property localAddress
localAddress?: string;
The source IP address to use for TCP connection
property maxIdle
maxIdle?: number;
property maxPreparedStatements
maxPreparedStatements?: number;
property multipleStatements
multipleStatements?: boolean;
Allow multiple mysql statements per query. Be careful with this, it exposes you to SQL injection attacks. (Default: false)
property namedPlaceholders
namedPlaceholders?: boolean;
property nestTables
nestTables?: boolean | string;
property password
password?: string;
The password of that MySQL user
property password1
password1?: string;
Alias for the MySQL user password. Makes a bit more sense in a multifactor authentication setup (see "password2" and "password3")
property password2
password2?: string;
2nd factor authentication password. Mandatory when the authentication policy for the MySQL user account requires an additional authentication method that needs a password. https://dev.mysql.com/doc/refman/8.0/en/multifactor-authentication.html
property password3
password3?: string;
3rd factor authentication password. Mandatory when the authentication policy for the MySQL user account requires two additional authentication methods and the last one needs a password. https://dev.mysql.com/doc/refman/8.0/en/multifactor-authentication.html
property passwordSha1
passwordSha1?: string;
property pool
pool?: any;
property port
port?: number;
The port number to connect to. (Default: 3306)
property Promise
Promise?: any;
property queryFormat
queryFormat?: (query: string, values: any) => void;
A custom query format function
property queueLimit
queueLimit?: number;
property rowsAsArray
rowsAsArray?: boolean;
Return each row as an array, not as an object. This is useful when you have duplicate column names. This can also be set in the
QueryOption
object to be applied per-query.
property socketPath
socketPath?: string;
The path to a unix domain socket to connect to. When used host and port are ignored
property ssl
ssl?: string | SslOptions;
object with ssl parameters or a string containing name of ssl profile
property stream
stream?: any;
property stringifyObjects
stringifyObjects?: boolean;
Stringify objects instead of converting to values. (Default: 'false')
property supportBigNumbers
supportBigNumbers?: boolean;
When dealing with big numbers (BIGINT and DECIMAL columns) in the database, you should enable this option (Default: false)
property timezone
timezone?: string | 'local';
The timezone used to store local dates. (Default: 'local')
property trace
trace?: boolean;
Generates stack traces on Error to include call site of library entrance ('long stack traces'). Slight performance penalty for most calls. (Default: true)
property typeCast
typeCast?: TypeCast;
Determines if column values should be converted to native JavaScript types.
true
It is not recommended (and may go away / change in the future) to disable type casting, but you can currently do so on either the connection or query level.
---
You can also specify a function to do the type casting yourself:
(field: Field, next: () => void) => {return next();}---
**WARNING:**
YOU MUST INVOKE the parser using one of these three field functions in your custom typeCast callback. They can only be called once:
field.string();field.buffer();field.geometry();Which are aliases for:
parser.parseLengthCodedString();parser.parseLengthCodedBuffer();parser.parseGeometryValue();You can find which field function you need to use by looking at
RowDataPacket.prototype._typeCast
.
property uri
uri?: string;
property user
user?: string;
The MySQL user to authenticate as
property waitForConnections
waitForConnections?: boolean;
interface ErrorPacketParams
interface ErrorPacketParams {}
interface Field
interface Field extends TypeCastField {}
Deprecated
Field
is deprecated and might be removed in the future major release. Please useTypeCastField
type instead.
interface FieldPacket
interface FieldPacket {}
property catalog
catalog: string;
property characterSet
characterSet?: number;
property charsetNr
charsetNr?: number;
property columnLength
columnLength?: number;
property columnType
columnType?: number;
property constructor
constructor: { name: 'FieldPacket';};
property db
db?: string;
property decimals
decimals: number;
property default
default?: any;
property encoding
encoding?: string;
property flags
flags: number | string[];
property length
length?: number;
property name
name: string;
property orgName
orgName: string;
property orgTable
orgTable: string;
property protocol41
protocol41?: boolean;
property schema
schema?: string;
property table
table: string;
property type
type?: number;
property typeName
typeName?: string;
property zerofill
zerofill?: boolean;
interface OkPacket
interface OkPacket {}
Deprecated
OkPacket
is deprecated and might be removed in the future major release. Please useResultSetHeader
instead.
property affectedRows
affectedRows: number;
property changedRows
changedRows: number;
Deprecated
changedRows
is deprecated and might be removed in the future major release. Please useaffectedRows
property instead.
property constructor
constructor: { name: 'OkPacket';};
property fieldCount
fieldCount: number;
property insertId
insertId: number;
property message
message: string;
property protocol41
protocol41: boolean;
property serverStatus
serverStatus: number;
property warningCount
warningCount: number;
interface OkPacketParams
interface OkPacketParams {}
property affectedRows
affectedRows?: number;
property insertId
insertId?: number;
property message
message?: string;
property serverStatus
serverStatus?: number;
property warningCount
warningCount?: number;
interface Pool
interface Pool extends BasePool {}
interface PoolCluster
interface PoolCluster extends BasePoolCluster {}
interface PoolClusterOptions
interface PoolClusterOptions {}
property canRetry
canRetry?: boolean;
If true, PoolCluster will attempt to reconnect when connection fails. (Default: true)
property defaultSelector
defaultSelector?: string;
The default selector. (Default: RR) RR: Select one alternately. (Round-Robin) RANDOM: Select the node by random function. ORDER: Select the first node available unconditionally.
property removeNodeErrorCount
removeNodeErrorCount?: number;
If connection fails, node's errorCount increases. When errorCount is greater than removeNodeErrorCount, remove a node in the PoolCluster. (Default: 5)
property restoreNodeTimeout
restoreNodeTimeout?: number;
If connection fails, specifies the number of milliseconds before another connection attempt will be made. If set to 0, then node will be removed instead and never re-used. (Default: 0)
interface PoolConnection
interface PoolConnection extends BasePoolConnection {}
interface PoolNamespace
interface PoolNamespace extends QueryableAndExecutableBase {}
method getConnection
getConnection: ( callback: ( err: NodeJS.ErrnoException | null, connection: PoolConnection ) => any) => void;
interface PoolOptions
interface PoolOptions extends ConnectionOptions {}
property connectionLimit
connectionLimit?: number;
The maximum number of connections to create at once. (Default: 10)
property idleTimeout
idleTimeout?: number;
The idle connections timeout, in milliseconds. (Default: 60000)
property maxIdle
maxIdle?: number;
The maximum number of idle connections. (Default: same as
connectionLimit
)
property queueLimit
queueLimit?: number;
The maximum number of connection requests the pool will queue before returning an error from getConnection. If set to 0, there is no limit to the number of queued connection requests. (Default: 0)
property waitForConnections
waitForConnections?: boolean;
Determines the pool's action when no connections are available and the limit has been reached. If true, the pool will queue the connection request and call it when one becomes available. If false, the pool will immediately call back with an error. (Default: true)
interface Prepare
interface Prepare extends BasePrepare {}
interface Query
interface Query extends BaseQuery {}
interface QueryError
interface QueryError extends NodeJS.ErrnoException {}
property code
code: string;
Either a MySQL server error (e.g. 'ER_ACCESS_DENIED_ERROR'), a node.js error (e.g. 'ECONNREFUSED') or an internal error (e.g. 'PROTOCOL_CONNECTION_LOST').
property fatal
fatal: boolean;
Boolean, indicating if this error is terminal to the connection object.
property fieldCount
fieldCount?: number;
The field count
property sqlState
sqlState?: string;
The sql state
property sqlStateMarker
sqlStateMarker?: string;
The sql state marker
interface QueryOptions
interface QueryOptions {}
property infileStreamFactory
infileStreamFactory?: (path: string) => Readable;
By specifying a function that returns a readable stream, an arbitrary stream can be sent when sending a local fs file.
property namedPlaceholders
namedPlaceholders?: boolean;
This overrides the namedPlaceholders option set at the connection level.
property nestTables
nestTables?: any;
Either a boolean or string. If true, tables will be nested objects. If string (e.g. '_'), tables will be nested as tableName_fieldName
property rowsAsArray
rowsAsArray?: boolean;
This overrides the same option set at the connection level.
property sql
sql: string;
The SQL for the query
property timeout
timeout?: number;
Every operation takes an optional inactivity timeout option. This allows you to specify appropriate timeouts for operations. It is important to note that these timeouts are not part of the MySQL protocol, and rather timeout operations through the client. This means that when a timeout is reached, the connection it occurred on will be destroyed and no further operations can be performed.
property typeCast
typeCast?: TypeCast;
Determines if column values should be converted to native JavaScript types.
true
It is not recommended (and may go away / change in the future) to disable type casting, but you can currently do so on either the connection or query level.
---
You can also specify a function to do the type casting yourself:
(field: Field, next: () => void) => {return next();}---
**WARNING:**
YOU MUST INVOKE the parser using one of these three field functions in your custom typeCast callback. They can only be called once:
field.string();field.buffer();field.geometry();Which are aliases for:
parser.parseLengthCodedString();parser.parseLengthCodedBuffer();parser.parseGeometryValue();You can find which field function you need to use by looking at
RowDataPacket.prototype._typeCast
.
property values
values?: any | any[] | { [param: string]: any };
The values for the query
interface ResultSetHeader
interface ResultSetHeader {}
property affectedRows
affectedRows: number;
property changedRows
changedRows: number;
Deprecated
changedRows
is deprecated and might be removed in the future major release. Please useaffectedRows
property instead.
property constructor
constructor: { name: 'ResultSetHeader';};
property fieldCount
fieldCount: number;
property info
info: string;
property insertId
insertId: number;
property serverStatus
serverStatus: number;
property warningStatus
warningStatus: number;
interface RowDataPacket
interface RowDataPacket {}
property constructor
constructor: { name: 'RowDataPacket';};
index signature
[column: string]: any;
index signature
[column: number]: any;
interface SslOptions
interface SslOptions {}
property ca
ca?: string | string[] | Buffer | Buffer[];
Either a string/Buffer or list of strings/Buffers of PEM encoded CA certificates to trust.
property cert
cert?: string | string[] | Buffer | Buffer[];
A string/buffer or list of strings/Buffers holding the PEM encoded certificate(s)
property ciphers
ciphers?: string;
A string describing the ciphers to use or exclude
property crl
crl?: string | string[];
Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
property key
key?: string | string[] | Buffer | Buffer[];
Either a string/buffer or list of strings/Buffers holding the PEM encoded private key(s) to use
property maxVersion
maxVersion?: string;
Configure the maximum supported version of SSL, the default is TLSv1.3.
property minVersion
minVersion?: string;
Configure the minimum supported version of SSL, the default is TLSv1.2.
property passphrase
passphrase?: string;
A string of passphrase for the private key or pfx
property pfx
pfx?: string;
A string or buffer holding the PFX or PKCS12 encoded private key, certificate and CA certificates
property rejectUnauthorized
rejectUnauthorized?: boolean;
You can also connect to a MySQL server without properly providing the appropriate CA to trust. You should not do this.
property verifyIdentity
verifyIdentity?: boolean;
You can verify the server name identity presented on the server certificate when connecting to a MySQL server. You should enable this but it is disabled by default right now for backwards compatibility.
interface Types
interface Types {}
property 0x00
0x00: string;
property 0x01
0x01: string;
property 0x02
0x02: string;
property 0x03
0x03: string;
property 0x04
0x04: string;
property 0x05
0x05: string;
property 0x06
0x06: string;
property 0x07
0x07: string;
property 0x08
0x08: string;
property 0x09
0x09: string;
property 0x0a
0x0a: string;
property 0x0b
0x0b: string;
property 0x0c
0x0c: string;
property 0x0d
0x0d: string;
property 0x0e
0x0e: string;
property 0x0f
0x0f: string;
property 0x10
0x10: string;
property 0xf2
0xf2: string;
property 0xf5
0xf5: string;
property 0xf6
0xf6: string;
property 0xf7
0xf7: string;
property 0xf8
0xf8: string;
property 0xf9
0xf9: string;
property 0xfa
0xfa: string;
property 0xfb
0xfb: string;
property 0xfc
0xfc: string;
property 0xfd
0xfd: string;
property 0xfe
0xfe: string;
property 0xff
0xff: string;
property BIT
BIT: number;
property BLOB
BLOB: number;
property DATE
DATE: number;
property DATETIME
DATETIME: number;
property DECIMAL
DECIMAL: number;
property DOUBLE
DOUBLE: number;
property ENUM
ENUM: number;
property FLOAT
FLOAT: number;
property GEOMETRY
GEOMETRY: number;
property INT24
INT24: number;
property JSON
JSON: number;
property LONG
LONG: number;
property LONG_BLOB
LONG_BLOB: number;
property LONGLONG
LONGLONG: number;
property MEDIUM_BLOB
MEDIUM_BLOB: number;
property NEWDATE
NEWDATE: number;
property NEWDECIMAL
NEWDECIMAL: number;
property NULL
NULL: number;
property SET
SET: number;
property SHORT
SHORT: number;
property STRING
STRING: number;
property TIME
TIME: number;
property TIMESTAMP
TIMESTAMP: number;
property TINY
TINY: number;
property TINY_BLOB
TINY_BLOB: number;
property VAR_STRING
VAR_STRING: number;
property VARCHAR
VARCHAR: number;
property VECTOR
VECTOR: number;
property YEAR
YEAR: number;
Type Aliases
type AuthPlugin
type AuthPlugin = (pluginMetadata: { connection: Connection; command: string;}) => ( pluginData: Buffer) => Promise<string> | string | Buffer | Promise<Buffer> | null;
type AuthPluginDefinition
type AuthPluginDefinition<T> = (pluginOptions?: T) => AuthPlugin;
type ProcedureCallPacket
type ProcedureCallPacket<T = [RowDataPacket[], ResultSetHeader] | ResultSetHeader> = T extends RowDataPacket[] ? [T, ResultSetHeader] : T extends ResultSetHeader | OkPacket ? ResultSetHeader : [RowDataPacket[], ResultSetHeader] | ResultSetHeader;
type QueryResult
type QueryResult = | OkPacket | ResultSetHeader | ResultSetHeader[] | RowDataPacket[] | RowDataPacket[][] | OkPacket[] | ProcedureCallPacket;
type TypeCast
type TypeCast = ((field: Field, next: Next) => any) | boolean;
type TypeCastField
type Field = Type & { length: number; db: string; table: string; name: string; string: (encoding?: BufferEncoding | string | undefined) => string | null; buffer: () => Buffer | null; geometry: () => Geometry | Geometry[] | null;};
type TypeCastGeometry
type Geometry = { x: number; y: number;};
type TypeCastNext
type Next = () => void;
type TypeCastType
type Type = { type: | 'DECIMAL' | 'TINY' | 'SHORT' | 'LONG' | 'FLOAT' | 'DOUBLE' | 'NULL' | 'TIMESTAMP' | 'TIMESTAMP2' | 'LONGLONG' | 'INT24' | 'DATE' | 'TIME' | 'TIME2' | 'DATETIME' | 'DATETIME2' | 'YEAR' | 'NEWDATE' | 'VARCHAR' | 'BIT' | 'VECTOR' | 'JSON' | 'NEWDECIMAL' | 'ENUM' | 'SET' | 'TINY_BLOB' | 'MEDIUM_BLOB' | 'LONG_BLOB' | 'BLOB' | 'VAR_STRING' | 'STRING' | 'GEOMETRY';};
Package Files (22)
- index.d.ts
- typings/mysql/index.d.ts
- typings/mysql/lib/Auth.d.ts
- typings/mysql/lib/Connection.d.ts
- typings/mysql/lib/Pool.d.ts
- typings/mysql/lib/PoolCluster.d.ts
- typings/mysql/lib/constants/CharsetToEncoding.d.ts
- typings/mysql/lib/constants/Charsets.d.ts
- typings/mysql/lib/constants/Types.d.ts
- typings/mysql/lib/parsers/ParserCache.d.ts
- typings/mysql/lib/parsers/typeCast.d.ts
- typings/mysql/lib/protocol/packets/Field.d.ts
- typings/mysql/lib/protocol/packets/FieldPacket.d.ts
- typings/mysql/lib/protocol/packets/OkPacket.d.ts
- typings/mysql/lib/protocol/packets/ProcedurePacket.d.ts
- typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts
- typings/mysql/lib/protocol/packets/RowDataPacket.d.ts
- typings/mysql/lib/protocol/packets/index.d.ts
- typings/mysql/lib/protocol/packets/params/ErrorPacketParams.d.ts
- typings/mysql/lib/protocol/packets/params/OkPacketParams.d.ts
- typings/mysql/lib/protocol/sequences/Prepare.d.ts
- typings/mysql/lib/protocol/sequences/Query.d.ts
Dependencies (9)
Dev Dependencies (17)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/mysql2
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/mysql2)
- HTML<a href="https://www.jsdocs.io/package/mysql2"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 8344 ms. - Missing or incorrect documentation? Open an issue for this package.