解决方法:
6 M. h- j+ ~( _! B: q/ t$ I
* U3 L; Y: ^3 ]修改MySQL数据库配置文件etc/my.cnf
2 P' x2 D$ m) X( N/ A- k, C* b% x1 H' ?" L
在[mysqld]最下面添加
/ \4 a! o" ^3 @6 P# n
5 N& n4 O3 e# \skip-name-resolve
, V n" e- O6 ~( X. _; e; R! n
2 ~/ Z+ U' I$ z# For advice on how to change settings please see
' g5 W/ e- y- F7 `& s b! T#
http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
* n- B# q. ~6 K2 W v1 }% O) I[mysqld]
7 Y9 p1 b+ q, L" d
#
% B8 y, g. ]3 S# n3 B1 `3 Q5 H4 q# Remove leading # and set to the amount of RAM for the most important data
- d7 [8 S0 ^/ {* \
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
( m! I; U# W' r) o- y1 j# innodb_buffer_pool_size = 128M
k& N; s; n8 A& n# {5 i/ J$ k#
7 U. D: e- J+ I
# Remove leading # to turn on a very important data integrity option:
! f, j4 P4 B! a4 _; U
logging
' s0 X8 w" V/ z# E) F' q# changes to the binary log between backups.
. T8 A# x3 l; m. |" C. `
# log_bin
! a4 x7 X `$ y9 \2 ]#
" @) s( N! A/ ~. }! G* s8 f/ O
# Remove leading # to set options mainly useful for reporting servers.
2 P# M! `/ |, c- `# The server defaults are faster for transactions and fast SELECTs.
7 e+ A2 C4 w; R, ]0 {8 z q ?$ m
# Adjust sizes as needed, experiment to find the optimal values.
0 b0 Q b: ]9 P( z: O6 W
# join_buffer_size = 128M
' V2 `$ y5 E9 ?4 @. O$ z0 z2 W; B# sort_buffer_size = 2M
3 r I& x. {2 F- ~4 h y
# read_rnd_buffer_size = 2M
+ t! E% l5 O( w, b
datadir=/var/lib/mysql s
: S7 I1 T- x' \+ s/ V& \& u
ocket=/var/lib/mysql/mysql.sock
) X, u3 c! E: a6 j0 p, ]
# Disabling symbolic-links is recommended to prevent
4 K: O& c! z1 J J7 \assorted security risks
1 `, f, U9 c! M' t$ V* e/ l4 f
symbolic-links=0
2 P$ f/ ?' D7 _9 r% |' Y0 a% g, p W6 p# Recommended in standard MySQL setup
J9 V4 {8 a: B! O/ L2 F+ }
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
& [' B* V% n0 l! s. @/ d+ c0 dmax_allowed_packet = 32M
2 q7 k2 q( n8 i
max_connections = 1000
% @! c' | [! T3 z1 q
max_connect_errors = 2000
: |3 J; X0 o/ ]. ~/ N B! I0 g- rskip-name-resolve
3 A0 X; R& Z4 c* e2 [! Y
[mysqld_safe]
1 |1 Z: x: }' b2 }. R/ i1 Y
log-error=/var/log/mysqld.log
, v1 Y1 {3 J- Y: mpid-file=/var/run/mysqld/mysqld.pid
% Y, [: x) h+ n+ p( [. \然后重启MySQL服务
4 l: l9 S+ z: ~$ ~$ k2 ? N6 ]0 ^& @8 u, ~7 ~" \: }! Y
service mysqld restart
/ c! I; [* I! C; g4 [3 ~3 U
) f! @4 Y5 j9 H5 i3 Q4 p2 m