解决方法:
/ J2 y, j* M9 X7 Y U5 `* @0 K, h+ Y
9 _: ?: K+ n# }7 q3 G修改MySQL数据库配置文件etc/my.cnf
; g8 A* f( l- @* e; \( U) w
: c9 s0 M# [3 r7 ~, u8 I1 c9 u- p在[mysqld]最下面添加
0 E- t2 U# a# C: c( C
: I' n' O J6 D, D- q7 Lskip-name-resolve
+ _2 p$ `8 V( L7 {
]! ^3 g. W" P( W9 o# For advice on how to change settings please see
* D( m J- x2 {#
http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
' [8 y: }& W1 X( s1 Y% F, v* U[mysqld]
$ f2 a' V. [4 l) l) b% O$ }" g. w#
4 l) }4 e2 P8 j
# Remove leading # and set to the amount of RAM for the most important data
( M$ t5 K9 ^ A5 b% k- W
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
) Z) _5 C6 P( h# u( v0 f4 t6 a) P# innodb_buffer_pool_size = 128M
4 r6 K, G1 u- e; `2 z. T) F8 V7 \5 m#
6 y# `* S% n' u
# Remove leading # to turn on a very important data integrity option:
+ Q& c5 f/ m2 p
logging
/ d: C0 j+ l" \1 x# changes to the binary log between backups.
5 z, }) Z; J; U1 A1 f0 \# log_bin
, Y; H- h" f" M3 j! \#
( b3 p( Q1 E2 Y& |9 t! t# Remove leading # to set options mainly useful for reporting servers.
$ s9 n# l! P9 ~' k/ x. o
# The server defaults are faster for transactions and fast SELECTs.
/ u* h% z9 b8 U' }; p S
# Adjust sizes as needed, experiment to find the optimal values.
, M- P1 D6 ~& A7 @# join_buffer_size = 128M
% X7 ?8 R1 ]3 ?( U/ I
# sort_buffer_size = 2M
/ C% G) ~7 p6 P7 f- _/ @8 F# read_rnd_buffer_size = 2M
7 j' |* H. V7 x9 k# i2 L1 i
datadir=/var/lib/mysql s
, h( D9 j# R/ }7 ?ocket=/var/lib/mysql/mysql.sock
! H) [) ^6 r/ P) p5 I
# Disabling symbolic-links is recommended to prevent
6 w5 U# r7 h5 x' D0 M( Sassorted security risks
# _) [# q2 z# w8 w* B
symbolic-links=0
+ U9 q6 K" R: ~! y# Recommended in standard MySQL setup
- g$ B0 h6 F v7 a#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
$ R2 C4 r3 E8 V5 n
max_allowed_packet = 32M
+ w$ i/ ^' U) E# ]( c% ?6 ~max_connections = 1000
: b9 }6 M' `; L! Amax_connect_errors = 2000
6 z& i$ A8 x B- }skip-name-resolve
4 C; s7 J, A7 e6 L$ u8 F$ |
[mysqld_safe]
; P, l2 h D, k, O2 E7 l; Tlog-error=/var/log/mysqld.log
3 y, p( J& F; Fpid-file=/var/run/mysqld/mysqld.pid
& |. E) e" K/ N3 Q* u然后重启MySQL服务
7 F5 u6 w: I- u! p- }
2 O ~9 `2 p5 K. P" B% i- sservice mysqld restart
" z6 h; \. s0 B9 A1 d j7 V1 H2 \* y2 v