美图齐众专注资阳网站设计 资阳网站制作 资阳网站建设
资阳网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

MySQL驱动参数大全,以备不时之需

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 处理属性

属性名称

默认值

发布版本

http://zsjierui.cn/article/dpoishi.html

免费获取网站建设与品牌策划方案报价

*主要业务范围包括:高端网站建设, 集团网站建设(网站建设网站制作)找网站建设公司就上美图齐众。
提交需求

    联系我们

    028-86922220
  • 手机:13518219792
  • 地址:成都市太升南路288号锦天国际A幢1002号
  • 24小时服务热线:028-86922220

    网站建设服务

  • 网页设计
  • 网站制作
  • 网站开发

    网站推广服务

  • 营销网站建设
  • 百度快速排名
  • 整站网站推广

    网站运维服务

  • 基础维护
  • 网站改版
  • 网站维护

    FOLLOW US

  • 微信二维码

    微信二维码

Copyright © 2025 资阳站青羊区美图齐众设计工作室(个体工商户) 资阳网站建设公司-选网站建设公司美图齐众!专业的网站制作公司!
All Rights Reserved 版权所有 蜀ICP备2025119604号-1