解决方法:
, K7 P% d3 x# V& X& r- S& w
: K% D& E3 L9 o8 _2 i, R: c! U" K! G修改MySQL数据库配置文件etc/my.cnf
+ y2 p, I" z; w+ ]$ Z* s
$ X' K$ A C4 J+ Z1 G
在[mysqld]最下面添加
! {/ U" K4 s. b, v5 n9 [
& V! A$ [4 W3 I/ ^skip-name-resolve
0 B& |: {1 h I! b2 ~+ }
r5 l- _+ B& I. b6 \' `
# For advice on how to change settings please see
) C: V6 n2 T# j2 F0 r, L+ y* G8 {#
http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
9 `1 h' k6 |; F; k0 p# b[mysqld]
% H$ m( F& j* m! U#
$ N/ K6 i3 _+ v' o+ A
# Remove leading # and set to the amount of RAM for the most important data
1 e# j4 L# W( a
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
4 r: n- h+ M7 U, H5 U/ ^; a, P
# innodb_buffer_pool_size = 128M
) y$ H) e7 X' y+ h1 P#
* K' N5 }4 ]. ]0 T2 ~, N6 c8 I$ I" R
# Remove leading # to turn on a very important data integrity option:
7 ^( }) O5 K2 p+ k/ g7 S' G: f7 ^. I
logging
0 k+ o5 a# G' o; ^6 M0 x
# changes to the binary log between backups.
' G6 w7 g, j6 F$ \/ h2 R
# log_bin
) X% \! @; O+ e8 y/ z+ ^
#
9 F4 N( Y2 W8 k+ U" h* J( T, U
# Remove leading # to set options mainly useful for reporting servers.
# F/ t; V! O2 T& D s: R# The server defaults are faster for transactions and fast SELECTs.
7 L8 k: l$ R' D# Adjust sizes as needed, experiment to find the optimal values.
% x) n1 F1 `+ F/ p, z. J
# join_buffer_size = 128M
1 T. N! B! e: @* F; y' i5 j1 g( Y# sort_buffer_size = 2M
. v. y! P. _, s5 W, e. s$ s7 j
# read_rnd_buffer_size = 2M
( w: w# O7 C7 A* j7 E ?& k" l8 Qdatadir=/var/lib/mysql s
% C% x* d5 {2 ~5 ]. e$ u
ocket=/var/lib/mysql/mysql.sock
1 s/ O+ J+ M7 `, o3 Q8 P
# Disabling symbolic-links is recommended to prevent
' {8 M8 e' x6 O/ }/ ]
assorted security risks
8 U; x9 Y, l' ^
symbolic-links=0
; a1 |, \. n( O; w+ n
# Recommended in standard MySQL setup
4 s) j- ?; M7 w3 ^& k7 z
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
# \# z, [1 |# M; M- t& Q# Y
max_allowed_packet = 32M
/ y5 Q" h* `. ~+ I5 [max_connections = 1000
; Z9 ^' I. E' W. L/ R4 K
max_connect_errors = 2000
, c/ _7 m7 w. s4 X& D% ~+ }' Vskip-name-resolve
$ k; ~5 S' t! J4 v1 D1 I
[mysqld_safe]
/ G' C" x% [0 ]' k9 I* R3 Rlog-error=/var/log/mysqld.log
( q G U9 y" ^. apid-file=/var/run/mysqld/mysqld.pid
( @3 _- \ `6 b& c5 @3 X# \
然后重启MySQL服务
& Q2 m h8 B2 R, `( k2 w
$ c% T' A/ c% b4 e* kservice mysqld restart
( |" v: y7 z5 o( c9 J- Q2 B" T1 |- G