新聞中心
MySQL驅(qū)動(dòng)參數(shù)你知道多少呢?常見的幾個(gè)大家應(yīng)該都見過,如下:

|
參數(shù) |
說明 |
|
user |
數(shù)據(jù)庫用戶名 |
|
password |
用戶密碼 |
|
useUnicode |
是否使用Unicode字符集,如果參數(shù)characterEncoding設(shè)置為gb2312或gbk,本參數(shù)值必須設(shè)置為true |
|
characterEncoding |
當(dāng)useUnicode設(shè)置為true時(shí),指定字符編碼。比如可設(shè)置為gb2312或gbk |
|
autoReconnect |
當(dāng)數(shù)據(jù)庫連接異常中斷時(shí),是否自動(dòng)重新連接。true為自動(dòng)連接;false則相反。 |
|
autoReconnectForPools |
是否使用針對數(shù)據(jù)庫連接池的重連策略 |
|
failOverReadOnly |
自動(dòng)重連成功后,連接是否設(shè)置為只讀 |
|
maxReconnects |
設(shè)置為true時(shí),重試連接的次數(shù)3 |
|
initialTimeout |
設(shè)置為true時(shí),兩次重連之間的時(shí)間間隔,單位:秒 |
|
connectTimeout |
連接超時(shí)框時(shí)間(以毫秒為單位),0 表示沒有超時(shí)。 |
|
socketTimeout |
網(wǎng)絡(luò)套接字操作的超時(shí)時(shí)間,以毫秒為單位指定。值“0”表示沒有超時(shí)。 |
|
sslMode |
默認(rèn)情況下,網(wǎng)絡(luò)連接是 SSL 加密的;此屬性允許關(guān)閉安全連接,或選擇不同的安全級別。 |
|
connectionTimeZone |
數(shù)據(jù)庫連接時(shí)區(qū) |
|
rewriteBatchedStatements |
重寫SQL,以提高批量操作的性能 |
|
logSlowQueries |
是否啟用慢查詢?nèi)罩?/p> |
|
slowQueryThresholdMillis |
logSlowQueries為true的情況下,此參數(shù)用于配置慢查詢的時(shí)間,大于 這個(gè)值就是慢查詢 |
以下是所有的屬性配置,當(dāng)我們生產(chǎn)環(huán)境中遇到問題的時(shí)候,就可以用這些參數(shù)來排查問題,以及進(jìn)行一些調(diào)優(yōu)。
1 身份驗(yàn)證的屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 連接屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 網(wǎng)絡(luò)屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 安全屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 元數(shù)據(jù)屬性
|
屬性名稱 |
默認(rèn)值 |
發(fā)布版本 |
|
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 |


咨詢
建站咨詢
