游客发表

MySQL驱动参数你知道多少呢?驱全备常见的几个大家应该都见过,如下:
参数
说明
user
数据库用户名
password
用户密码
useUnicode
是动参否使用Unicode字符集,如果参数characterEncoding设置为gb2312或gbk,驱全备本参数值必须设置为true
characterEncoding
当useUnicode设置为true时,动参指定字符编码。驱全备比如可设置为gb2312或gbk
autoReconnect
当数据库连接异常中断时,动参是驱全备否自动重新连接。true为自动连接;false则相反。动参
autoReconnectForPools
是驱全备否使用针对数据库连接池的重连策略
failOverReadOnly
自动重连成功后,连接是动参否设置为只读
maxReconnects
设置为true时,重试连接的服务器租用驱全备次数3
initialTimeout
设置为true时,两次重连之间的动参时间间隔,单位:秒
connectTimeout
连接超时框时间(以毫秒为单位),驱全备0 表示没有超时。动参
socketTimeout
网络套接字操作的驱全备超时时间,以毫秒为单位指定。值“0”表示没有超时。
sslMode
默认情况下,网络连接是 SSL 加密的;此属性允许关闭安全连接,或选择不同的安全级别。
connectionTimeZone
数据库连接时区
rewriteBatchedStatements
重写SQL,云服务器以提高批量操作的性能
logSlowQueries
是否启用慢查询日志
slowQueryThresholdMillis
logSlowQueries为true的情况下,此参数用于配置慢查询的时间,大于 这个值就是慢查询
以下是所有的属性配置,当我们生产环境中遇到问题的时候,就可以用这些参数来排查问题,以及进行一些调优。
1 身份验证的属性属性名称
默认值
发布版本
user
-
所有版本
password
-
所有版本
password1
-
8.0.28
password2
-
8.0.28
password3
-
8.0.28
authenticationPlugins
-
5.1.19
disabledAuthenticationPlugins
-
5.1.19
ociConfigFile
-
8.0.27
authenticationFidoCallbackHandler
-
8.0.29
defaultAuthenticationPlugin
mysql_native_password
5.1.19
ldapServerHostname
-
8.0.23
2 连接属性属性名称
默认值
发布版本
connectionAttributes
-
5.1.25
connectionLifecycleInterceptors
-
5.1.4
useConfigs
-
3.1.5
clientInfoProvider
com.mysql.cj.jdbc.CommentClientInfoProvider
5.1.0
createDatabaseIfNotExist
false
3.1.9
databaseTerm
CATALOG
8.0.17
detectCustomCollations
false
5.1.29
disconnectOnExpiredPasswords
true
5.1.23
interactiveClient
false
3.1.0
passwordCharacterEncoding
-
5.1.7
propertiesTransform
-
3.1.4
rollbackOnPooledClose
true
3.0.15
useAffectedRows
false
5.1.7
3 Session 属性属性名称
默认值
发布版本
sessionVariables
-
3.1.8
characterEncoding
-
1.1g
characterSetResults
-
3.0.13
connectionCollation
-
3.0.13
customCharsetMapping
-
8.0.26
trackSessionState
false
8.0.26
4 网络属性属性名称
默认值
发布版本
socksProxyHost
-
5.1.34
socksProxyPort
1080
5.1.34
socketFactory
com.mysql.cj.protocol.StandardSocketFactory
3.0.3
connectTimeout
0
3.0.1
socketTimeout
0
3.0.1
dnsSrv
false
8.0.19
localSocketAddress
-
5.0.5
maxAllowedPacket
65535
5.1.8
socksProxyRemoteDns
false
8.0.29
tcpKeepAlive
true
5.0.7
tcpNoDelay
true
5.0.7
tcpRcvBuf
0
5.0.7
tcpSndBuf
0
5.0.7
tcpTrafficClass
0
5.0.7
useCompression
false
3.0.17
useUnbufferedInput
true
3.0.11
5 安全属性属性名称
默认值
发布版本
paranoid
false
3.0.1
serverRSAPublicKeyFile
-
5.1.31
allowPublicKeyRetrieval
false
5.1.31
sslMode
PREFERRED
8.0.13
trustCertificateKeyStoreUrl
-
5.1.0
trustCertificateKeyStoreType
JKS
5.1.0
trustCertificateKeyStorePassword
-
5.1.0
fallbackToSystemTrustStore
true
8.0.22
clientCertificateKeyStoreUrl
-
5.1.0
clientCertificateKeyStoreType
JKS
5.1.0
clientCertificateKeyStorePassword
-
5.1.0
fallbackToSystemKeyStore
true
8.0.22
tlsCiphersuites
-
5.1.35
tlsVersions
-
8.0.8
allowLoadLocalInfile
false
3.0.3
allowLoadLocalInfileInPath
-
8.0.22
allowMultiQueries
false
3.1.1
allowUrlInLocalInfile
false
3.1.4
requireSSL
false
3.1.0
useSSL
true
3.0.2
verifyServerCertificate
false
5.1.6
6 Statements 属性属性名称
默认值
发布版本
cacheDefaultTimeZone
true
8.0.20
continueBatchOnError
true
3.0.3
dontTrackOpenResources
false
3.1.7
queryInterceptors
-
8.0.7
queryTimeoutKillsConnection
false
5.1.9
7 Prepared Statements 属性属性名称
默认值
发布版本
allowNanAndInf
false
3.1.5
autoClosePStmtStreams
false
3.1.12
compensateOnDuplicateKeyUpdateCounts
false
5.1.7
emulateUnsupportedPstmts
true
3.1.7
generateSimpleParameterMetadata
false
5.0.5
processEscapeCodesForPrepStmts
true
3.1.12
useServerPrepStmts
false
3.1.0
useStreamLengthsInPrepStmts
true
3.0.2
8 Result Sets 属性属性名称
默认值
发布版本
clobberStreamingResults
false
3.0.9
emptyStringsConvertToZero
true
3.1.8
holdResultsOpenOverStatementClose
false
3.1.7
jdbcCompliantTruncation
true
3.1.2
maxRows
-1
all versions
netTimeoutForStreamingResults
600
5.1.0
padCharsWithSpace
false
5.0.6
populateInsertRowWithDefaultValues
false
5.0.5
scrollTolerantForwardOnly
false
8.0.24
strictUpdates
true
3.0.4
tinyInt1isBit
true
3.0.16
transformedBitIsBoolean
false
3.1.9
9 元数据属性属性名称
默认值
发布版本
getProceduresReturnsFunctions
true
5.1.26
noAccessToProcedureBodies
false
5.0.3
nullDatabaseMeansCurrent
false
3.1.8
useHostsInPrivileges
true
3.0.2
useInformationSchema
false
5.0.0
10 BLOB/CLOB 处理属性属性名称
默认值
发布版本
autoDeserialize
false
3.1.5
blobSendChunkSize
1048576
3.1.9
blobsAreStrings
false
5.0.8
clobCharacterEncoding
-
5.0.0
emulateLocators
false
3.1.0
functionsNeverReturnBlobs
false
5.0.8
locatorFetchBufferSize
1048576
3.2.1
11 Datetime 类型处理属性属性名称
默认值
发布版本
connectionTimeZone
-
3.0.2
forceConnectionTimeZoneToSession
false
8.0.23
noDatetimeStringSync
false
3.1.7
preserveInstants
true
8.0.23
sendFractionalSeconds
true
5.1.37
sendFractionalSecondsForTime
true
8.0.23
treatUtilDateAsTimestamp
true
5.0.5
yearIsDateType
true
3.1.9
zeroDateTimeBehavior
EXCEPTION
3.1.4
12 高可用性和集群属性属性名称
默认值
发布版本
autoReconnect
false
1.1
autoReconnectForPools
false
3.1.3
failOverReadOnly
true
3.0.12
maxReconnects
3
1.1
reconnectAtTxEnd
false
3.0.10
retriesAllDown
120
5.1.6
initialTimeout
2
1.1
queriesBeforeRetrySource
50
3.0.2
secondsBeforeRetrySource
30
3.0.2
allowReplicaDownConnections
false
6.0.2
allowSourceDownConnections
false
5.1.27
ha.enableJMX
false
5.1.27
loadBalanceHostRemovalGracePeriod
15000
6.0.3
readFromSourceWhenNoReplicas
false
6.0.2
selfDestructOnPingMaxOperations
0
5.1.6
selfDestructOnPingSecondsLifetime
0
5.1.6
ha.loadBalanceStrategy
random
5.0.6
loadBalanceAutoCommitStatementRegex
-
5.1.15
loadBalanceAutoCommitStatementThreshold
0
5.1.15
loadBalanceBlocklistTimeout
0
5.1.0
loadBalanceConnectionGroup
-
5.1.13
loadBalanceExceptionChecker
com.mysql.cj.jdbc.ha.StandardLoadBalanceExceptionChecker
5.1.13
loadBalancePingTimeout
0
5.1.13
loadBalanceSQLExceptionSubclassFailover
-
5.1.13
loadBalanceSQLStateFailover
-
5.1.13
loadBalanceValidateConnectionOnSwapServer
false
5.1.13
pinGlobalTxToPhysicalConnection
false
5.0.1
replicationConnectionGroup
-
8.0.7
resourceId
-
5.0.1
serverAffinityOrder
-
8.0.8
13 性能扩展属性属性名称
默认值
发布版本
callableStmtCacheSize
100
3.1.2
metadataCacheSize
50
3.1.1
useLocalSessionState
false
3.1.7
useLocalTransactionState
false
5.1.7
prepStmtCacheSize
25
3.0.10
prepStmtCacheSqlLimit
256
3.0.10
queryInfoCacheFactory
com.mysql.cj.PerConnectionLRUFactory
5.1.1
serverConfigCacheFactory
com.mysql.cj.util.PerVmServerConfigCacheFactory
5.1.1
alwaysSendSetIsolation
true
3.1.7
maintainTimeStats
true
3.1.9
useCursorFetch
false
5.0.0
cacheCallableStmts
false
3.1.2
cachePrepStmts
false
3.0.10
cacheResultSetMetadata
false
3.1.1
cacheServerConfiguration
false
3.1.5
defaultFetchSize
0
3.1.9
dontCheckOnDuplicateKeyUpdateInSQL
false
5.1.32
elideSetAutoCommits
false
3.1.3
enableEscapeProcessing
true
6.0.1
enableQueryTimeouts
true
5.0.6
largeRowSizeThreshold
2048
5.1.1
readOnlyPropagatesToServer
true
5.1.35
rewriteBatchedStatements
false
3.1.13
useReadAheadInput
true
3.1.5
14 调试/分析属性属性名称
默认值
发布版本
logger
com.mysql.cj.log.StandardLogger
3.1.1
profilerEventHandler
com.mysql.cj.log.LoggingProfilerEventHandler
5.1.6
useNanosForElapsedTime
false
5.0.7
maxQuerySizeToLog
2048
3.1.3
maxByteArrayAsHex
1024
8.0.31
profileSQL
false
3.1.0
logSlowQueries
false
3.1.2
slowQueryThresholdMillis
2000
3.1.2
slowQueryThresholdNanos
0
5.0.7
autoSlowLog
true
5.1.4
explainSlowQueries
false
3.1.2
gatherPerfMetrics
false
3.1.2
reportMetricsIntervalMillis
30000
3.1.2
logXaCommands
false
5.0.5
traceProtocol
false
3.1.2
enablePacketDebug
false
3.1.3
packetDebugBufferSize
20
3.1.3
useUsageAdvisor
false
3.1.1
resultSetSizeThreshold
100
5.0.5
autoGenerateTestcaseScript
false
3.1.9
15 异常/警告属性属性名称
默认值
发布版本
dumpQueriesOnException
false
3.1.3
exceptionInterceptors
-
5.1.8
ignoreNonTxTables
false
3.0.9
includeInnodbStatusInDeadlockExceptions
false
5.0.7
includeThreadDumpInDeadlockExceptions
false
5.1.15
includeThreadNamesAsStatementComment
false
5.1.15
useOnlyServerErrorMessages
true
3.0.15
16 集成其他产品的免费信息发布网调优属性属性名称
默认值
发布版本
overrideSupportsIntegrityEnhancementFacility
false
3.1.12
ultraDevHack
false
2.0.3
17 JDBC合规属性属性名称
默认值
发布版本
useColumnNamesInFindColumn
false
5.1.7
pedantic
false
3.0.0
useOldAliasMetadataBehavior
false
5.0.4
18 X协议和X DevAPI属性属性名称
默认值
发布版本
xdevapi.auth
PLAIN
8.0.8
xdevapi.compression
PREFERRED
8.0.20
xdevapi.compression-algorithms
zstd_stream,lz4_message,deflate_stream
8.0.22
xdevapi.compression-extensions
-
8.0.22
xdevapi.connect-timeout
10000
8.0.13
xdevapi.connection-attributes
-
8.0.16
xdevapi.dns-srv
false
8.0.19
xdevapi.fallback-to-system-keystore
true
8.0.22
xdevapi.fallback-to-system-truststore
true
8.0.22
xdevapi.ssl-keystore
-
8.0.22
xdevapi.ssl-keystore-password
-
8.0.22
xdevapi.ssl-keystore-type
JKS
8.0.22
xdevapi.ssl-mode
REQUIRED
8.0.7
xdevapi.ssl-truststore
-
6.0.6
xdevapi.ssl-truststore-password
-
6.0.6
xdevapi.ssl-truststore-type
JKS
6.0.6
xdevapi.tls-ciphersuites
-
8.0.19
xdevapi.tls-versions
-
8.0.19
随机阅读
热门排行
友情链接