解决方法:
, C7 L: F" I* Q0 K4 p$ @" p
: \5 [! U% t( j! M) H修改MySQL数据库配置文件etc/my.cnf
0 l; i" v1 G$ G1 T& _# V2 i- I/ x& s+ @1 c! C( [
在[mysqld]最下面添加
- d. R9 @7 U5 c$ _4 e( w
& O& K6 |; d2 k% y+ tskip-name-resolve
* p2 ?7 ]* j. @4 V7 a+ ~
9 @! _! e1 v6 x& A3 F# For advice on how to change settings please see
; m5 m3 ~# |! @$ n5 j. V#
http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
' z. T! r6 T G/ l[mysqld]
3 D3 H8 l U0 X7 M) [6 e#
7 X" X- x" w0 v' m/ B% G3 C
# Remove leading # and set to the amount of RAM for the most important data
5 Y3 c" }, z2 V( H: y6 W
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
$ R6 s* S$ F6 x$ E) h; m9 n; i) C0 z
# innodb_buffer_pool_size = 128M
8 Q$ b% r# Y# o
#
( e3 V9 I/ N* P: w! M0 J# i# Remove leading # to turn on a very important data integrity option:
: T# ~4 g# P' u' y& a! _( ^
logging
' l0 H! R# m# v7 t! h2 G$ c4 p& W# changes to the binary log between backups.
+ w: c1 |; x( y6 p# log_bin
6 ?% A0 j) z4 r; A2 H2 f" k( _
#
) c4 {& }/ E" H b F3 d) \2 J/ G2 b
# Remove leading # to set options mainly useful for reporting servers.
5 c9 D3 @% R4 B6 u: B9 t# The server defaults are faster for transactions and fast SELECTs.
2 g0 F+ @+ `0 V% }* B! b3 _# Adjust sizes as needed, experiment to find the optimal values.
9 X- |/ |' H9 w. u4 N0 p8 ?# join_buffer_size = 128M
, A5 q1 x0 x! V! C/ p# sort_buffer_size = 2M
. F+ g+ ^! N8 V- T( s2 k4 z# read_rnd_buffer_size = 2M
! G( u+ J; R7 Q$ V8 E# ~datadir=/var/lib/mysql s
% S* j }+ Q& C P8 r
ocket=/var/lib/mysql/mysql.sock
u8 M3 W- h) l
# Disabling symbolic-links is recommended to prevent
) h3 Z( `# b- B' q( c5 W: B
assorted security risks
2 M- o' Z* `: i& a6 g
symbolic-links=0
6 p4 ]. ?# f- e, k3 O# Recommended in standard MySQL setup
1 @: G t8 `3 W/ D
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
5 H3 R: ?& R0 v0 l
max_allowed_packet = 32M
. o9 W- ?: h* ~6 O& B2 D2 }max_connections = 1000
" z m2 p9 r1 T D" b
max_connect_errors = 2000
0 B6 C. x: y0 iskip-name-resolve
) |8 G( B) B( ~" V$ U, c
[mysqld_safe]
2 u% N8 c. a7 E4 ^: r' w, ~log-error=/var/log/mysqld.log
1 @7 W; x0 T0 M- |+ V* ?pid-file=/var/run/mysqld/mysqld.pid
! @ J: S0 j7 E$ F0 N _然后重启MySQL服务
& \1 b( r% p. l( V; O
. E- ^1 W7 G+ t* V# x2 z4 tservice mysqld restart
& p6 k# B6 W S
! }$ a9 ]- Z! Y/ x$ n6 U