mysql连接数,druid的连接数

my.ini


// 注册数据库驱动
Class.forName(driver);

DriverManager.getConnection(url, user, password);  按max_connections=1000 的设置,最多可以同时打开1000个。所以使用完成后,就要关闭close。

# The MySQL server
[mysqld]
basedir=""
datadir=""
default-character-set=utf8
default-storage-engine=innodb
max_allowed_packet =12M

wait_timeout=31536000
interactive_timeout=31536000
max_connections=1000

port = 3306
socket = MySQL
skip-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 500
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

druid.properties

driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/****?characterEncoding=utf-8&serverTimezone=UTC
username=root
password=root
initialSize=5
maxActive=10
maxWait=3000

posted @ 2023-01-30 17:55  古锁阳关  阅读(245)  评论(0编辑  收藏  举报