解决方法:
. o) p, }8 B j% r: v9 P7 j: P
4 Z6 q$ j- _6 c
修改MySQL数据库配置文件etc/my.cnf
8 ]3 \8 N% R6 R$ _. T3 `
6 S2 Q& {. D+ q5 Y! F- I% b在[mysqld]最下面添加
9 i: v* m2 D/ y% q7 q# i0 V' Z5 ?% d# O$ b
skip-name-resolve
% i2 P/ R5 R, T$ C
! A0 r" x$ B2 G' c) E
# For advice on how to change settings please see
5 x2 x6 z! f8 u+ G7 t' m3 f#
http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
4 c/ n% Z7 n- P$ w# @$ C3 f[mysqld]
) B! N0 @- E4 N2 B/ Z0 h' ]4 o/ B
#
& | ^) H! k* b; p( ~# Remove leading # and set to the amount of RAM for the most important data
$ ]5 \$ N. p8 c% q- @- d, X3 V# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
1 c0 o! i3 W6 a! I# ~/ @& V# innodb_buffer_pool_size = 128M
+ e1 M! }7 g! n7 P
#
9 S! {2 Z8 P5 q! M/ D# Remove leading # to turn on a very important data integrity option:
" {4 e3 M0 n) _
logging
6 q! {% K9 U& f/ _# changes to the binary log between backups.
& T4 z& n, F. q
# log_bin
H0 t* q- E: a+ {1 g
#
6 D6 b0 m' S" h% A; U6 b8 M& j# Remove leading # to set options mainly useful for reporting servers.
7 ^% ]: _0 R9 W- U* [4 P* l& y
# The server defaults are faster for transactions and fast SELECTs.
a* q5 u5 O3 M: U2 \
# Adjust sizes as needed, experiment to find the optimal values.
, O- |8 {5 Y- m# k) k
# join_buffer_size = 128M
& q, l, P$ C' m6 k6 c# sort_buffer_size = 2M
$ ?9 {, Q+ V# o/ Q5 u# read_rnd_buffer_size = 2M
9 Q7 Q* ^% v4 e, J
datadir=/var/lib/mysql s
+ f% y( x- X8 Y; |8 L4 Zocket=/var/lib/mysql/mysql.sock
4 U. D: C( R. b* |4 a) z4 _# Disabling symbolic-links is recommended to prevent
8 D% w, m$ A, Qassorted security risks
5 G$ d* o$ Q% o7 h+ o+ k. Qsymbolic-links=0
% q8 ?9 m8 W' d- n
# Recommended in standard MySQL setup
/ a) u. |/ x& i4 k0 M
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
) A9 X7 J3 d. A* r1 Z2 i
max_allowed_packet = 32M
7 X5 e5 x' @0 T$ T E$ Omax_connections = 1000
8 b8 T8 k# \5 Z+ ?+ o k) ]
max_connect_errors = 2000
: A7 K% s- ~1 G: G
skip-name-resolve
8 z- Q C7 e/ |8 \[mysqld_safe]
" X* a5 M F. N1 D* T$ H, e: X3 K
log-error=/var/log/mysqld.log
6 y3 a" C1 \0 x9 m% F; L% vpid-file=/var/run/mysqld/mysqld.pid
& s! ^8 n* [2 l! |
然后重启MySQL服务
0 C; @/ Q+ P2 A' D5 R: D& { i+ R
service mysqld restart
! ?% i. u. n; ~4 i( E$ { D. M. H
1 `8 D# K4 q `9 d( ]