#chooseanunusedportnumber
, {1 ]. F' f+ e) ? #inthisconfiguration63132,63133,and631343 o$ d4 F3 `# H. r7 ]! l
#willbeused, S! q3 y2 H6 e+ W0 _& c% {; V
[tcpdefault]
4 y4 V, \# E: E9 U) l0 Z1 o1 f PortNumber=631326 `5 a, v8 q9 ^# b. D) R! U$ x
my.cnf
0 V' y) @0 K, s& o+ m8 W4 ]) L #ExampleMySQLconfigfileformediumsystems.
) g9 s, ? ? q. r% h5 D G #
4 P2 X5 K& o1 v& j3 F #ThisisforasystemwithlittlememorywhereMySQLplays
% j9 ^6 t% d' ?) m- C' o #animportantpart,orsystemsupto128MwhereMySQLisusedtogetherwith
, t' K' t' e. u& |" C #otherprograms
8 M; m6 I% ]% j& L) Z7 V #. \" K& b5 V2 j$ A
#Youcancopythisfileto
! k4 R( ]; }0 Z4 B! q #/etc/my.cnftosetglobaloptions,
! Y( k; _$ X5 m4 s7 I #mysql-data-dir/my.cnftosetserver-specificoptionsor
* X& T2 G! o" N6 o) M #~/.my.cnftosetuser-specificoptions.
. D& Q3 ?; Y: J+ n # A' G9 _! A& U
#Inthisfile,youcanusealllongoptionsthataprogramsupports.
# c1 j6 r6 C) Y# r2 r5 Y/ n #Ifyouwanttoknowwhichoptionsaprogramsupports,runtheprogram, W. G# F8 q+ Z% u
#withthe"--help"option." J' O) Z3 @9 |& Z* W0 h( E1 y! L
#ThefollowingoptionswillbepassedtoallMySQLclients% H4 U/ y S. h8 G9 D* Z
[client]
. _$ N }* {) U* F3 G! G. z #password=your_password
# D2 E. P9 |0 ~6 B9 \4 c, d port=3306, B% C0 P8 Q* J: b- s8 X5 N/ `; ]( N
socket=/tmp/mysql.sock
3 d- q& a/ |* g% q- m #Herefollowsentriesforsomespecificprograms
: q. M- T; t8 B' i [ #TheMySQLserver
4 e7 i* _6 c4 q, u1 L) o: K9 s i [mysqld]
$ x8 \8 A6 C! ] port=3306$ M1 a7 U- |( _1 d j) g
socket=/tmp/mysql.sock
; ` z5 A" O/ i7 _5 r skip-locking+ o# m. R' q" ?2 @% v! z
key_buffer=16M9 S3 ~, K& f, u* Y# n1 M, G2 U
max_allowed_packet=1M! o& ~" q. O' h G0 s: W
table_cache=64
) I6 w' a, S& Q5 k/ E: Q sort_buffer_size=512K1 _ R8 J( w Q
net_buffer_length=8K0 B6 G) F! x/ S4 m/ _. x0 G
read_buffer_size=256K6 E3 a% Y* s* t+ E5 A
read_rnd_buffer_size=512K
! X5 D* D1 ?. S+ n+ B" D: T myisam_sort_buffer_size=8M
' @" {: U8 F$ B# z" S( k) Z #Don‘tlistenonaTCP/IPportatall.Thiscanbeasecurityenhancement,! W) w" ?& w2 p& N" q) ^
#ifallprocessesthatneedtoconnecttomysqldrunonthesamehost.% @: X% _* H' M1 C
#AllinteractionwithmysqldmustbemadeviaUnixsocketsornamedpipes.
* h: ~' H$ C3 z #NotethatusingthisoptionwithoutenablingnamedpipesonWindows
) c3 f5 G- B8 b #willrendermysqlduseless!
* c( ] V/ m- {1 F P( o2 l. {% m #
0 ~* X+ y9 \' q+ g #skip-networking
( v; z+ r; H: o+ E ] #ReplicationMasterServer# j7 _' ^8 t; D+ n0 v7 L
#binaryloggingisrequiredforreplication1 K" L: Y0 X( X: E9 ~& H$ I
log-bin=mysql-bin
7 m8 _ g0 i. y P #requireduniqueidbetween1and2^32-1
5 r% a' u( r; O0 Q; H #defaultsto1ifmaster-hostisnotset
. W1 k6 ^' ?2 C3 Q- l #butwillnotfunctionasamasterifomitted
! l8 [$ N% P6 Q6 Y& @ server-id=1
/ a8 k9 ~, h5 L7 C #ReplicationSlave
. i$ L5 K% N& i/ q( z+ J3 Z2 T8 r #0 t/ k5 V1 H9 N; f, u1 A
#Toconfigurethishostasareplicationslave,youcanchoosebetween
; t& w3 k: r6 |4 P# A #twomethods:
( k% H s+ ^; h- S& z. h* O ## {, b7 Y/ j* P1 U. S4 s) x6 W/ D! B
#1)UsetheCHANGEMASTERTOcommand-
& D' m4 o" L3 W' h4 k0 w5 G' ^ #thesyntaxis:
w1 V; D# s( m8 s2 P #
0 K. D3 S4 d. I. ~' W #CHANGEMASTERTOMASTER_HOST=host,MASTER_PORT=port,3 y- f; ~. Y9 D' k+ n" Q
#MASTER_USER=user,MASTER_PASSWORD=password;
1 t7 m% f, c& F: I/ x #
2 D/ K( A: s5 M9 X #whereyoureplacehost,user,passwordbyquotedstringsand" k4 b# U, Q0 k, ?# {
#portbythemaster‘sportnumber.
_3 T& U; x; U' i' c+ H3 V # x+ }5 B" S1 E1 X) J. }
#Example:+ B& C* r5 _/ E* `) F- {
#9 A! @9 x: H7 c) h
#CHANGEMASTERTOMASTER_HOST=‘125.564.12.1‘,MASTER_PORT=3306,
1 m6 z: _7 e: [" \, j #MASTER_USER=‘joe‘,MASTER_PASSWORD=‘secret‘;
( }4 o! d+ G! I$ M* j2 Y #
- C: G% d% v1 e$ v3 x #OR& h7 q5 v$ w! b% M0 g
## ]: Z6 \ g; ?+ A: O( c
#2)Setthevariablesbelow.However,incaseyouchoosethismethod,then& N9 |1 r. U4 c+ i0 t, w% l
#startreplicationforthefirsttime,theslavewillcreateamaster.infofile,andanylater
1 K" d a" \* s, l7 [ #changeinthisfiletothevariables‘valuesbelowwillbeignoredand+ Q& L6 q. D2 e9 V/ u
#overriddenbythecontentofthemaster.infofile,unlessyoushutdown
4 |4 ]/ `5 R2 W* b* m1 t/ f9 a- r #theslaveserver,deletemaster.infoandrestarttheslaverserver.
; ?3 `% m+ f4 F. D3 S #Forthatreason,youmaywanttoleavethelinesbelowuntouched8 ~9 ]1 l Y9 j
#andinsteaduseCHANGEMASTERTO! n+ I! R8 c4 \( `5 w' w
#/ G( V) a) R, E6 j; P
#requireduniqueidbetween2and2^32-1
9 M: \5 _5 m) M" O) K! ~ #
: m: U/ L! ?" [7 v' ^7 j, N% h. s #defaultsto2ifmaster-hostisset" [6 _+ ~2 Q' B$ ?) J) g1 _& [
#butwillnotfunctionasaslaveifomitted</p>% P: L& A8 G2 e! o4 S8 S+ m" m
#server-id=2; w6 o4 h6 D4 z4 _7 [5 J ]
#9 T' X3 D5 n4 k( s5 m& O2 n* g
#Thereplicationmasterforthisslave-required
R+ P- I5 S9 G' f# b( z5 j #master-host=hostname
# W; q& s) O! o: b9 Z% U* a #
# D/ V6 Y7 Q! e; }, }! \5 U( n- d #Theusernametheslavewilluseforauthenticationwhenconnecting
. k* v2 H4 w4 @8 R( v# w #tothemaster-required
$ O" ~- P. z6 D/ e6 c #master-user=username0 d3 @, Y7 @( Q+ ?
# |