国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > MySQL > 正文

mysql優(yōu)化配置參數(shù)

2020-01-19 00:10:58
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
第一種
復(fù)制代碼 代碼如下:

#This File was made using the WinMySQLAdmin 1.4 Tool
#2004-2-23 16:28:14
#Uncomment or Add only the keys that you know how works.
#Read the MySQL Manual for instructions
[mysqld]
basedir=D:/mysql
#bind-address=210.5.*.*
datadir=D:/mysql/data
#language=D:/mysql/share/your language directory
#slow query log#=
#tmpdir#=
#port=3306
set-variable = max_connections=1500
skip-locking
#skip-networking
set-variable = key_buffer=384M
set-variable = max_allowed_packet=1M
set-variable = table_cache=512
set-variable = sort_buffer=2M
set-variable = record_buffer=2M
set-variable = thread_cache=8
# Try number of CPU's*2 for thread_concurrency
set-variable = thread_concurrency=8
set-variable = myisam_sort_buffer_size=64M
#set-variable = connect_timeout=5
#set-variable = wait_timeout=5
server-id = 1
[isamchk]
set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M
[myisamchk]
set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M
[WinMySQLadmin]
Server=D:/mysql/bin/mysqld-nt.exe

這個(gè)方案,整體夠用了,但是在pconnect和最大連接數(shù)上,需要研究max_connections沒(méi)必要那么大,我個(gè)人認(rèn)為幾百就夠,否則給服務(wù)器加大了不少負(fù)擔(dān),經(jīng)常會(huì)當(dāng)機(jī)連接超時(shí)的設(shè)置也要根據(jù)實(shí)際情況調(diào)整,大家可以自由調(diào)整,然后觀察效果如何。
第二種
  7、MYSQL 的優(yōu)化(/etc/my.cnf)
1)確認(rèn)在“[mysqld]”部分加入了“skip-innodb”和“skip-bdb”參數(shù);
2)確認(rèn)在“[mysqld]”部分加入了“skip-name-resolve”和“skip-locking”參數(shù);
3)如果不需要的話,可以將二進(jìn)制日志(binlog)停掉,方法是將“l(fā)og-bin”注釋掉;
4)在內(nèi)存允許的情況下,對(duì)一些參數(shù)進(jìn)行重新配置,目標(biāo)在于將大部分操作集中于內(nèi)存中,盡量不進(jìn)行磁盤(pán)操作,對(duì)于我的 MYSQL 服務(wù)器我是如下修改的,基于 2G 內(nèi)存情況:
復(fù)制代碼 代碼如下:

[mysqld]
set-variable = key_buffer=512M
set-variable = max_allowed_packet=4M
set-variable = table_cache=1024
set-variable = thread_cache=64
set-variable = join_buffer_size=32M
set-variable = sort_buffer=32M
set-variable = record_buffer=32M
set-variable = max_connections=512
set-variable = wait_timeout=120
set-variable = interactive_timeout=120
set-variable = max_connect_errors=30000
set-variable = long_query_time=1
set-variable = max_heap_table_size=256M
set-variable = tmp_table_size=128M
set-variable = thread_concurrency=8
set-variable = myisam_sort_buffer_size=128M

你可以根據(jù)“show status”命令返回的狀態(tài)進(jìn)行微調(diào)。我主要注意以下變量的數(shù)值,越小越好,最好為零:)
Created_tmp_disk_tables
Created_tmp_tables
Created_tmp_files
Slow_queries
另外 mysql wait_timeout 那個(gè)值設(shè)置大了沒(méi)用 做10左右就可了 (大C說(shuō)得)
wait_timeout是使用長(zhǎng)久連線時(shí) 空閑進(jìn)程的控制只要數(shù)據(jù)庫(kù)在連接狀態(tài) 他是不進(jìn)行干預(yù)的 不管是否有查詢或更新操作把這個(gè)設(shè)置小一點(diǎn) 再使用pconnect就比較理想了 ;)
timeout的 主站蜘蛛池模板: 常州市| 罗江县| 香格里拉县| 志丹县| 常熟市| 横山县| 马尔康县| 武穴市| 湟源县| 巴林右旗| 梨树县| 喀喇沁旗| 盘山县| 黄骅市| 赤城县| 遂川县| 廊坊市| 鄄城县| 交城县| 田阳县| 行唐县| 辰溪县| 收藏| 大方县| 泽库县| 昂仁县| 南宫市| 吴旗县| 岳阳县| 东安县| 桦川县| 南陵县| 田阳县| 连云港市| 讷河市| 屏东市| 习水县| 仁寿县| 文化| 慈利县| 宁海县|