MySQL optimized configuration
Tmp_table_size Set Size 500MB
Key_buffer_size =384m//key_buffer_size Specifies the size of the buffer to use for the index, increasing it to get more
Good index processing performance. This parameter can be set to 256M or 384M for servers with around 4GB. Attention
: The value of the parameter set too large will be the overall efficiency of the server down!
Sort_buffer_size = 17MB//Sort Cache
READ_BUFFER_SIZE=4M//Read cache
TABLE_CACHE=256//
Ft_min_word_len//Full-Text Search
Query_cache_size Query Caching
?
#!/bin/sh
#written by Cuiyang 20081118
###### #检查mysql状态
Port= ' Netstat-na | grep "LISTEN" | grep "3306" | awk ' {print $} ' | Awk-f. ' {print $} '
If ["$PORT"-eq "3306"]
Then
###### #检查mysql占CPU负载
Mysql_cpu= ' Top-u root-b-N 1 | grep MySQL | awk ' {print $} ' |awk-f. ' {print '} '
# #如果mysql CPU load is greater than 80, restart MySQL
If ["$mysql _cpu"-ge "80"]
Then
PS xww |grep ' bin/mysqld_safe ' |grep-v grep | awk ' {print $} ' | Xargs kill-9
PS xww |grep ' libexec/mysqld ' |grep-v grep | awk ' {print $} ' | Xargs kill-9
Sleep 5
/usr/local/mysql/bin/mysqld_safe--user=root >/dev/null &
Else
Exit 0
Fi
Else
/usr/local/mysql/bin/mysqld_safe--user=root >/dev/null &
Fi
?>
Number of affected columns: 4999 (query takes 0.1756 seconds)
UPDATE ' zgy_jobs_faces ' SET postime = ' 1250784000 ' WHERE jid <505000 and Jid >500000
Jobs_faces Field
Field Type Collation property Null default extra action
Jid Int (a) UNSIGNED no auto_increment
OID Int (0) UNSIGNED
CID Mediumint (8) UNSIGNED no 0
Requests smallint (4) UNSIGNED no 0
Views Mediumint (6) UNSIGNED is 0
Checked tinyint (1) UNSIGNED no 0
istoped tinyint (1) UNSIGNED no 0
Postime Int (a) UNSIGNED no 0
Losetime Int (a) UNSIGNED no 0
toped tinyint (1) UNSIGNED no 0
Toptime Int (a) UNSIGNED no 0
Bold tinyint (1) UNSIGNED no 0
Highlight varchar (7) Gbk_chinese_ci No
Lightime Int (a) UNSIGNED no 0
People smallint (4) UNSIGNED no 0
Sex tinyint (1) UNSIGNED no 0
Djobskinds varchar () gbk_chinese_ci No
Jname varchar () gbk_chinese_ci No
Number of affected columns: 4999 (query takes 0.2393 seconds)
UPDATE ' zgy_jobs_fields ' SET postime = ' 1250784000 ' WHERE jid <455000 and Jid >450000