Anda di halaman 1dari 58

MySQL Administration Workshop

Authors: Creation Date: Last 'pdate date: +ersion:

Trifon M. Anguelov Septem er !"# $%%& ()to er *# $%%& !.!

MySQL Administration Workshop

2.1 How to install mysql_server and mysql_client on FreeBSD machine


We are using the a,int.)orp.yahoo.)om test ma)hine 2.1.1 mysql_server installation -trifon./ine01homes1trifon 2 ssh a,int.)orp.yahoo.)om trifon.a,int.)orp.yahoo.)om3s pass/ord: Last login: Mon Sep $% !&:4&:5& $%%& from /ine.)orp.yahoo. Copyright 6)7 !89%# !895# !89*# !899# !88%# !88!# !885# !88& The :egents of the 'niversity of California. All rights reserved. -trifon.a,int01home1trifon 2

The installation of yinst pa)kages has to e done as ;root< (S user: $ sudo su The follo/ing )ommand installs the MySQL server 6mys=l>server7. Sin)e no version is spe)ified# the yinst /ill pi)k us the latest sta le version: # yinst install -same -live mysql_server yinst: ?dentifying pa)kages for installation ... yinst: @ound: mys=l>server,&.%.$$>! yinst: WA:A?AB: ?nstalling over an a)tive pa)kage: mys=l>server,&.%.$$>! yinst: Che)king prere=uisites ... C(DE yinst: 1home1y: yinst: S mys=l>server,&.%.$$>! yinst: @et)hing mys=l>server,&.%.$$>! ... C(DE yinst: mys=l>server,&.%.$$>! 6running install 6F:G,?ASTALL7 )ommands7 )he)king for mys=l user... (D )he)king for mys=l group... (D yinst: mys=l>server,&.%.$$>!: installing ... yinst: mys=l>server,&.%.$$>! 6running install 6F(ST,?ASTALL7 )ommands7 yinst: mys=l>server,&.%.$$>!: install pending ...

MySQL Administration Workshop

$ yinst: mys=l>server,&.%.$$>!: stopping ... yinst: mys=l>server,&.%.$$>! 6running dea)tivate 6DGACT?+ATG7 )ommands7 yinst: mys=l>server,&.%.$$>!: dea)tivating ... C(DE yinst: mys=l>server,&.%.$$>! 6running dea)tivate 6F(ST,DGACT?+ATG7 )ommands7 )he)king for 1et)1my.)nf symlink... (D removing 1et)1my.)nf symlink... (D yinst: mys=l>server,&.%.$$>!: removing ... C(DE yinst: mys=l>server,&.%.$$>!: install )ompleted yinst: mys=l>server,&.%.$$>! 6running a)tivate 6ACT?+ATG7 )ommands7 yinst: mys=l>server,&.%.$$>!: a)tivating ... yinst: mys=l>server,&.%.$$>! 6running a)tivate 6F(ST,ACT?+ATG7 )ommands7 )he)king for 1et)1my.)nf symlink... M?SS?AB )reating 1et)1my.)nf symlink... L?ADGD (D )he)king for already instllalled d files... (D yinst: mys=l>server,&.%.$$>! 6running post,a)tivate )ommands7 yinst: mys=l>server,&.%.$$>!: a)tivated yinst: mys=l>server,&.%.$$>!: starting ...

2.1.2

ysql_client installation

@or the MySQL )lient there is again already pa)kaged yinst pa)kage and it )ould e installed /ith the follo/ign )ommand: # yinst install mysql_client yinst: yinst: yinst: yinst: yinst: yinst: yinst: yinst: yinst: yinst: yinst: yinst: yinst: ?dentifying pa)kages for installation ... @ound: mys=l>)lient,&.%.$$>! Che)king prere=uisites ... C(DE 1home1y: ' mys=l>)lient,&.%.$$>! @et)hing mys=l>)lient,&.%.$$>! ... C(DE mys=l>)lient,&.%.$$>!: installing ... mys=l>)lient,&.%.$$>!: install pending ... mys=l>server,&.%.$$>!: stopping ... mys=l>)lient,&.%.!5>$: dea)tivating ... C(DE mys=l>)lient,&.%.$$>!: install )ompleted mys=l>)lient,&.%.$$>!: a)tivating ... C(DE mys=l>server,&.%.$$>!: starting ...

MySQL Administration Workshop

2.2
2.2.1

yS!" data#iles location


yS!" $inary #iles

The inary files installed from yinst are lo)ated in 1home1y1 in dire)tory: %root&a-int'(home(y(lo)s(mysql # ls -la * )re+ mysql ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H ,r,Hr,Hr,H $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ root root root root root root root root root root root root root root root root root root root root root root root root root root /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel /heel !9"!*% Sep !& !":!4 mysql &8*" Sep !& !":!4 mys=l>)onfig $89% Sep !& !":!4 mys=l>)onvert>ta le>format !%&$$ Sep !& !":!4 mys=l>eHplain>log $*4" Sep !& !":!4 mys=l>find>ro/s &9* Sep !& !":!4 mys=l>fiH>eHtensions !%5!" Sep !& !":!4 mys=l>fiH>privilege>ta les !&894 Sep !& !":!4 mys=l>install>d *5%9 Sep !& !":!4 mys=l>se)ure>installation !$* Sep !& !*:&" mys=l>server>ssl>)onf>fiH "$4 Aug !% !":%$ mys=l>server>ymon>setup !"$"9 Sep !& !":!4 mys=l>setpermission !5*4% Sep !& !":!4 mys=l>ta leinfo 5!$* Sep !& !":!4 mys=l>Iap !!!4$4 Sep !& !":!4 mys=la))ess $9$5& Sep !& !":!4 mysqladmin 44$*& Sep !& !":!4 mys=l inlog !%4$8 Sep !& !":!4 mys=l ug $!*%! Sep !& !":!4 mysqlchec, $%!%$ Sep !& !":!4 mys=ld>multi !%98% Sep !& !":!4 mys=ld>safe 594%! Sep !& !":!4 mysqldum+ &898 Sep !& !":!4 mys=ldumpslo/ 5$$9% Sep !& !":!4 mysqlhotco+y !"&%" Sep !& !":!4 mysqlim+ort $!""4 Sep !& !":!4 mysqlshow

Jou )an list the )omplete set of options for )ertain MySQL inary file y using the Khelp or ,L options /ith the )ommand. @or eHample: # mysql --hel+ # mysqladmin --

MySQL Administration Workshop

& 2.2.1.1 mysql . yS!" client te/t inter#ace

This inary is similar to the (ra)le ;s=lplus< inary and it3s the teHt ased interfa)e 6MySQL )lient7 to the MySQL data ase server. 'sage: mysql 0123415S6 0data$ase6 ,D# ,,data aseM.. Data ase to use ,e# ,,eHe)uteM... GHe)ute )ommand and =uit.6(utput like /ith ,, at)h7 ,h# ,,hostM... Conne)t to host ,pCpass/ordE ,,pass/ordCM...E Fass/ord to use /hen )onne)ting to server ?f pass/ord is not given it3s asked from the tty. ,F ,,portM... ,S ,,so)ketM... ,t ,,ta le ,u# ,,userMN ,G# ,,verti)al Fort num er to use for )onne)tion So)ket file to use for )onne)tion (utput in ta le format 'ser for login if not )urrent user Frint the output of a =uery 6ro/s7 verti)ally

Some eHamples of the options usage are: Conne)t as MySQL user ;root< on port ;55%*< to MySQL data ase ;TGSTDO< : # mysql -u root -2 7789 3:S3DB :eading ta le information for )ompletion of ta le and )olumn names Jou )an turn off this feature to get a =ui)ker startup /ith ,A Wel)ome to the MySQL monitor. Commands end /ith P or Qg. Jour MySQL )onne)tion id is $& to server version: &.%.$$,Jahoo,SMF,log Type 3help3 for help. mys=l0

MySQL Administration Workshop

4 The default port on /hi)h MySQL daemon 6mys=ld7 listens is 55%*. To )he)k this verify if the port 55%* is already in)luded in the 1et)1servi)es file and )he)k the open ports on the lo)al host: # cat (etc(services * )re+ 7789 mys=l 55%*1t)p NMySQL

# netstat -al * )re+ "4S3:5 t)p& t)p& t)p& t)p& t)p& t)p& t)p& t)p& % % % % % % % % % % % % % % % % R.mys=l R.http R.*5"$ R.*5"% R.*5*8 R.4$45 R. p)d R.ssh R.R R.R R.R R.R R.R R.R R.R R.R L?STGA L?STGA L?STGA L?STGA L?STGA L?STGA L?STGA L?STGA

mysql -u root -2 7789 -e ;show status; 3:S3DB S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,S T +aria le>name T +alue T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S T A orted>)lients T% T T A orted>)onne)ts T$ T T Oytes>re)eived T !4*5 T T Oytes>sent T 555!* T T Com>admin>)ommands T! T ... ...

MySQL Administration Workshop

* 2.2.1.2 mysqlshow - Shows the structure o# a <data$ases=ta$les and columns> yS!" data$ase

'sage: mysqlshow 0123415S6 0data$ase 0ta$le 0column666 ,N# ,,de ugM... ,L# ,,help ,C# ,,)ompress ,h# ,,hostM... ,i# ,,status ,k# ,,keys ,p# ,,pass/ordCM...E ,F ,,portM... ,S ,,so)ketM... ,u# ,,userMN ,+# ,,version output de ug log. (ften this is 3d:t:o#filenameU display this help and eHit 'se )ompression in server1)lient proto)ol )onne)t to host Sho/s a lot of eHtra information a out ea)h ta le sho/ keys for ta le pass/ord to use /hen )onne)ting to server ?f pass/ord is not given it3s asked from the tty. Fort num er to use for )onne)tion So)ket file to use for )onne)tion user for login if not )urrent user output version information and eHit

Sho/ all eHisting MySQL data ases on the lo)al host: # mysqlshow S,,,,,,,,,,,,,,,,,,,,S T Data ases T S,,,,,,,,,,,,,,,,,,,,S T TGSTDO T T JAV((BST T T mys=l T T mys=l> kp T T test T T test! T S,,,,,,,,,,,,,,,,,,,,S

Sho/ all ta les information in a single MySQL data ase: # mysqlshow -i 3:S3DB

MySQL Administration Workshop

"
Data ase: TGSTDO S,,,,,,S,,,,,,,,S,,,,,,,,,,,,S,,,,,,S,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,, S,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,,,,,,,S,,,,,,,,,S T Aame T Type T :o/>format T :o/s T Avg>ro/>length T Data>length T MaH>data>length T ?ndeH>length T Data>free T Auto>in)rement T Create>time T 'pdate>time T Che)k>time T Create>options T Comment T S,,,,,,S,,,,,,,,S,,,,,,,,,,,,S,,,,,,S,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,, S,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,,,,,,,S,,,,,,,,,S T test T My?SAM T Dynami) T 5 T $% T *% T &$8&8*"$84 T !%$& T% T $%%&,%8,!* !9:%%:&& T $%%&,%8,!* !9:%":!" T T T T S,,,,,,S,,,,,,,,S,,,,,,,,,,,,S,,,,,,S,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,, S,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,,,,,,,S,,,,,,,,,S

mys=lsho/ )an also e used to display the indeH information. Let3s )reate an indeH on our ;test< ta le in the ;TGSTDO< MySQL data ase: # mysql -u root 3:S3DB :eading ta le information for )ompletion of ta le and )olumn names Jou )an turn off this feature to get a =ui)ker startup /ith ,A Wel)ome to the MySQL monitor. Commands end /ith P or Qg. Jour MySQL )onne)tion id is *% to server version: &.%.$$,Jahoo,SMF,log Type 3help3 for help.

mysql' show ta$les? S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T Ta les>in>TGSTDO T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T test T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S ! ro/ in set 6%.%% se)7

MySQL Administration Workshop

9 mysql' desc test? S,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,S T @ield T Type T Aull T Dey T Default T GHtra T S,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,S T id T int6!!7 T JGS T T A'LL T T T first>name T teHt T JGS T T A'LL T T S,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,S $ ro/s in set 6%.%% se)7 mysql' create inde/ test_+, on test <id>? Query (D# 5 ro/s affe)ted 6%.%8 se)7 :e)ords: 5 Dupli)ates: % Warnings: % mysql' show inde/ #rom test?
S,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,, S,,,,,,,,,S T Ta le T Aon>uni=ue T Dey>name T Se=>in>indeH T Column>name T Collation T Cardinality T Su >part T Fa)ked T Aull T ?ndeH>type T Comment T S,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,, S,,,,,,,,,S T test T ! T test>pk T ! T id TA T A'LL T A'LL T A'LL T JGS T OT:GG T T S,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,, S,,,,,,,,,S ! ro/ in set 6%.%% se)7

Sho/ ta le3s indeH information: # mysqlshow -, 3:S3DB test


Data ase: TGSTDO Ta le: test :o/s: 5 S,,,,,,,,,,,,S,,,,,,,,,S,,,,,,S,,,,,S,,,,,,,,,S,,,,,,,S T @ield T Type T Aull T Dey T Default T GHtra T S,,,,,,,,,,,,S,,,,,,,,,S,,,,,,S,,,,,S,,,,,,,,,S,,,,,,,S T id T int6!!7 T JGS T M'L T T T T first>name T teHt T JGS T T T T S,,,,,,,,,,,,S,,,,,,,,,S,,,,,,S,,,,,S,,,,,,,,,S,,,,,,,S

MySQL Administration Workshop

8
S,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,, S,,,,,,,,,S T Ta le T Aon>uni=ue T Dey>name T Se=>in>indeH T Column>name T Collation T Cardinality T Su >part T Fa)ked T Aull T ?ndeH>type T Comment T S,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,, S,,,,,,,,,S T test T ! T test>pk T ! T id TA T T T T JGS T OT:GG T T S,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,, S,,,,,,,,,S

2.2.1.7 mysqldum+ - Dum+s de#inition and data ta$le

yS!" data$ase or

This MySQL inary is similar to the (ra)le ;eHp< inary. # mysqldum+ -- for options list 'sage: mysqldum+ 0123415S6 data$ase 0ta$les6 ,a# ,,all ?n)lude all MySQL spe)ifi) )reate options ,N# ,,de ugM... (utput de ug log. (ften this is 3d:t:o#filenameU ,L# ,,help Display this help message and eHit. ,)# ,,)omplete,insert 'se )omplete insert statements. ,C# ,,)ompress 'se )ompression in server1)lient proto)ol ,e# ,,eHtended,insert Allo/s utiliIation of the ne/# mu)h faster ?ASG:T syntaH ,,add,drop,ta le Add a 3drop ta le3 efore ea)h )reate ,,add,lo)ks Add lo)ks around insert statements ,,allo/,key/ords Allo/ )reation of )olumn names that are key/ords ,,delayed,insert ?nsert ro/s /ith ?ASG:T DGLAJGD ,@ ,,flush,logs @lush logs file in server efore starting dump ,f# ,,for)e Continue even if /e get an s=l,error. ,h# ,,hostM... Conne)t to host. ,l# ,,lo)k,ta les Lo)k all ta les for read. ,t# ,,no,)reate,info Don3t /rite ta le )reation info. ,d# ,,no,data Ao ro/ information. ,(# ,,set,varia le varMoption give a varia le a value. ,,help lists varia les ,,opt Same as ,,add,drop,ta le ,,add,lo)ks ,,all ,,eHtended,insert ,,=ui)k ,,lo)k,ta les

MySQL Administration Workshop

!% ,p# ,,pass/ordCM...E ,F# ,,portM... ,=# ,,=ui)k ,Q# ,,=uote,names ,S# ,,so)ketM... ,T# ,,ta M... Fass/ord to use /hen )onne)ting to server. ?f pass/ord is not given it3s soli)ited on the tty. Fort num er to use for )onne)tion. Don3t uffer =uery# dump dire)tly to stdout. Quote ta le and )olumn names /ith U So)ket file to use for )onne)tion. Creates ta separated teHtfile for ea)h ta le to given path. 6)reates .s=l and .tHt files7. A(TG: This only /orks if mys=ldump is run on the same ma)hine as the mys=ld daemon. 'ser for login if not )urrent user. Frint info a out the various stages. (utput version information and eHit. dump only sele)ted re)ordsP Q'(TGS mandatoryW

,u# ,,userMN ,v# ,,ver ose ,+# ,,version ,/# ,,/hereM

GHport MySQL data ase ;TGSTDO< stru)ture only and use user login for ;root<: %root&a-int' # mysqldum+ -u root -d 3:S3DB N MySQL dump ".! N N Vost: lo)alhost Data ase: TGSTDO N,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, N Server version &.%.$$,Jahoo,SMF,log N N Ta le stru)ture for ta le 3test3 N C:GATG TAOLG test 6 id int6!!7# first>name teHt 7P GHport MySQL data ase ;TGSTDO< data only and use user login for ;root<:

MySQL Administration Workshop

!! %root&a-int' # mysqldum+ -u root -t 3:S3DO N MySQL dump ".! N N Vost: lo)alhost Data ase: TGSTDO N,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, N Server version &.%.$$,Jahoo,SMF,log N N Dumping data for ta le 3test3 N ?ASG:T ?AT( test +AL'GS 6!#3TGST!37P ?ASG:T ?AT( test +AL'GS 6$#3TGST$37P ?ASG:T ?AT( test +AL'GS 65#3TGST537P

GHport MySQL data ase ;TGSTDO< stru)ture and data# /hile using user login for ;root<: %root&a-int' # mysqldum+ -u root 3:S3DB N MySQL dump ".! N N Vost: lo)alhost Data ase: TGSTDO N,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, N Server version &.%.$$,Jahoo,SMF,log N N Ta le stru)ture for ta le 3test3 N C:GATG TAOLG test 6 id int6!!7# first>name teHt 7P N N Dumping data for ta le 3test3 N ?ASG:T ?AT( test +AL'GS 6!#3TGST!37P ?ASG:T ?AT( test +AL'GS 6$#3TGST$37P ?ASG:T ?AT( test +AL'GS 65#3TGST537P

MySQL Administration Workshop

!$ We /ill )reate one more ta le in the ;TGSTDO< data ase to demonstrate the ta le level eHport: mysql' create ta$le test1 <id inte)er= salary inte)er= de+artment te/t>? Query (D# % ro/s affe)ted 6%.%! se)7 mysql' desc test1? S,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,S,,,,,S,,,,,,,,,,,,S,,,,,,,,S T @ield T Type T Aull T Dey T Default T GHtra T S,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,S,,,,,S,,,,,,,,,,,,,S,,,,,,,,S T id T int6!!7 T JGS T T A'LL T T T salary T int6!!7 T JGS T T A'LL T T T department T teHt T JGS T T A'LL T T S,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,S,,,,,S,,,,,,,,,,,,S,,,,,,,,S 5 ro/s in set 6%.%% se)7

GHport the stru)ture and data of ta le ;test< from MySQL data ase ;TGSTDO<# /hile using user login for ;root<: %root&a-int' # mysqldum+ -u root 3:S3DB test N MySQL dump ".! N N Vost: lo)alhost Data ase: TGSTDO N,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, N Server version &.%.$$,Jahoo,SMF,log N N Ta le stru)ture for ta le 3test3 N C:GATG TAOLG test 6 id int6!!7# first>name teHt# DGJ test>pk 6id7 7P

MySQL Administration Workshop

!5 N N Dumping data for ta le 3test3 N ?ASG:T ?AT( test +AL'GS 6!#3TGST!37P ?ASG:T ?AT( test +AL'GS 6$#3TGST$37P ?ASG:T ?AT( test +AL'GS 65#3TGST537P

We )an also eHport a list of ta les. GHport the stru)ture and data of ta les ;test< and ;test!< from MySQL data ase ;TGSTDO<# /hile using user login for ;root<:

%root&a-int' # mysqldum+ -u root 3:S3DB test test1 N MySQL dump ".! N N Vost: lo)alhost Data ase: TGSTDO N,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, N Server version &.%.$$,Jahoo,SMF,log N N Ta le stru)ture for ta le 3test3 N C:GATG TAOLG test 6 id int6!!7# first>name teHt# DGJ test>pk 6id7 7P N N Dumping data for ta le 3test3 N ?ASG:T ?AT( test +AL'GS 6!#3TGST!37P ?ASG:T ?AT( test +AL'GS 6$#3TGST$37P ?ASG:T ?AT( test +AL'GS 65#3TGST537P

MySQL Administration Workshop

!& N N Ta le stru)ture for ta le 3test!3 N C:GATG TAOLG test! 6 id int6!!7# salary int6!!7# department teHt 7P N N Dumping data for ta le 3test!3 N

The most )ommon use of mys=ldump is pro a ly for making a a)kup of entire data ases. ?n this )ase instead of spooling the mys=ldump )ommand output on the s)reen# /e /ill save it into a file. This is similar to the (ra)le ;eHp< utility /here DOA )an take a full a)kup of a single data ase: # mysqldum+ --o+t 3:S3DB ' $ac,u+-#ile.sql

Jou )an import 6load7 the dump file a)k into the MySQL server /ith: # mysql 3:S3DB % $ac,u+-#ile.sql (r: # mysql -e ;source (+ath-to-$ac,u+($ac,u+-#ile.sql; 3:S3DB

mys=ldump is also very useful for populating data ases y )opying data from one MySQL server to another: # mysqldum+ --o+t 3:S3DB * mysql --host@remote_host -A 3:S3DB1

MySQL Administration Workshop

!4 ?t is possi le to dump several data ases /ith one )ommand: # mysqldum+ --data$ases 3:S3DB 0test...6 ' my_data$ases.sql ?f you /ant to dump all data ases# use the ,,all,data ases option: # mysqldum+ --all-data$ases ' all_data$ases.sql

2.2.1.B mysqlim+ort . "oads a$les #rom te/t #iles in various #ormats This MySQL inary is similar to the (ra)le ;imp< utility. The ase name of the teHt file must e the name of the ta le that should e used. ?f one uses so)kets to )onne)t to the MySQL server# the server /ill open and read the teHt file dire)tly. ?n other )ases the )lient /ill open the teHt file. # mysqlim+ort -- for options list 'sage: mysqlim+ort 0123415S6 data$ase te/t#ile... ,N# ,,de ugCM...E ,L# ,,help ,C# ,,)ompress ,d# ,,delete ,f# ,,for)e ,h# ,,hostM... ,i# ,,ignore ,l# ,,lo)k,ta les ,L# ,,lo)al ,p# ,,pass/ordCM...E ,F# ,,portM... ,r# ,,repla)e ,s# ,,silent ,S# ,,so)ketM... ,u# ,,userMN ,v# ,,ver ose (utput de ug log. (ften this is 3d:t:o#filenameU Displays this help and eHits. 'se )ompression in server1)lient proto)ol Deletes first all ro/s from ta le. Continue even if /e get an s=l,error. Conne)t to host. ?f dupli)ate uni=ue key /as found# keep old ro/. Lo)k all ta les for /rite. :ead all files through the )lient Fass/ord to use /hen )onne)ting to server. ?f pass/ord is not given it3s asked from the tty. Fort num er to use for )onne)tion. ?f dupli)ate uni=ue key /as found# repla)e old ro/. Oe more silent. So)ket file to use for )onne)tion. 'ser for login if not )urrent user. Frint info a out the various stages.

MySQL Administration Workshop

!* ,+# ,,version (utput version information and eHit. ,,fields,terminated, yM... @ields in the teHtfile are terminated y ... ,,fields,en)losed, yM... @ields in the importfile are en)losed y ... ,,fields,optionally,en)losed, yM... @ields in the i.file are opt. en)losed y ... ,,fields,es)aped, yM... @ields in the i.file are es)aped y ... ,,lines,terminated, yM... Lines in the i.file are terminated y ...

We have )reated a test import file to import into ;TGSTDO< MySQL data ase# ta le ;test!< # cat (tm+(test1.dat !%% !%! !%$ !%5 44%%% *4%%% &4%%% "4%%% !% !$ $% $4

Che)k if there is any data in th e<test!< ta le: # mysql -u root -e ;select C #rom test1?; 3:S3DB N ?mport the data from 1tmp1test!.dat file into the ;test!< ta le in ;TGSTDO< MySQL data ase: # mysqlim+ort -u root 3:S3DB (tm+(test1.dat TGSTDO.test!: :e)ords: & Deleted: % Skipped: % Warnings: !$ Che)k the imported data: # mysql -u root -e ;select C #rom test1?; 3:S3DB

MySQL Administration Workshop

!" S,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,S T id T salary T department T S,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,S T !%% T A'LL T A'LL T T !%! T A'LL T A'LL T T !%$ T A'LL T A'LL T T !%5 T A'LL T A'LL T S,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,S

# mysqlim+ort -u root 3:S3DB (tm+(test1.dat TGSTDO.test!: :e)ords: & Deleted: % Skipped: % Warnings: !$ # mysql -u root -e ;select C #rom test1?; 3:S3DB S,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,S T id T salary T department T S,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,S T !%% T A'LL T A'LL T T !%! T A'LL T A'LL T T !%$ T A'LL T A'LL T T !%5 T A'LL T A'LL T T !%% T A'LL T A'LL T T !%! T A'LL T A'LL T T !%$ T A'LL T A'LL T T !%5 T A'LL T A'LL T S,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,S

We )an also trun)ate the ase ta le efore importing the data: # mysqlim+ort -d -u root 3:S3DB (tm+(test1.dat TGSTDO.test!: :e)ords: & Deleted: % Skipped: % Warnings: !$ # mysql -u root -e ;select C #rom test1?; 3:S3DB

MySQL Administration Workshop

!9 S,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,S T id T salary T department T S,,,,,,,S,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,S T !%% T A'LL T A'LL T T !%! T A'LL T A'LL T T !%$ T A'LL T A'LL T T !%5 T A'LL T A'LL T S,,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,S

2.2.2

yS!" data #iles

Oy default the MySQL data files are lo)ated in 1home1y1var1mys=l1data dire)tory: # ls -la (home(y(var(mysql(data(3:S3DB ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ! ! ! ! ! ! mys=l mys=l mys=l mys=l mys=l mys=l users users users users users users *% Sep $! !!:!9 test.MJD $%&9 Sep $! !!:!9 test.MJ? 949* Sep $! !!:!9 test.frm 9% Sep $! !!:&% test!.MJD !%$& Sep $! !!:4" test!.MJ? 9*!& Sep $! !!:$5 test!.frm

Gvery time ne/ MySQL data ase is )reated# a su ,dire)tory is )reated under this root dire)tory: ?f /e )reate a ne/ MySQL data ase: # mysqladmin -u root create 3:S3DB1 Data ase XTGSTDO!X )reated. We )an see the ne/ly )reated TGSTDO! su ,dire)tory: # ls -la (home(y(var(mysql(data dr/H,,,,,, $ mys=l users dr/H,,,,,, $ mys=l users 4!$ Sep $! !!:$5 TGSTDO 4!$ Sep $! !!:44 TGSTDO!

MySQL Administration Workshop

!8 (n)e the data ase is dropped# the su ,dire)tory and the data files are removed automati)ally: # mysqladmin -u root dro+ 3:S3DB1 Dropping the data ase is potentially a very ad thing to do. Any data stored in the data ase /ill e destroyed. Do you really /ant to drop the 3TGSTDO!3 data ase Cy1AE y Data ase XTGSTDO!X dropped # ls -la (home(y(var(mysql(data dr/H,,,,,, $ mys=l users 4!$ Sep $! !!:$5 TGSTDO

2.2.7

yS!" lo) #iles

MySQL logs y default are lo)ated under 1home1y1logs1mys=l dire)tory: # ls -la (home(y(lo)s(mysql( ,r/,r,,r,, ! mys=l users *** Sep !* !4:5$ mys=l.log ,r/,r/,,,, ! mys=l users &*$! Sep $! !!:49 mys=ld.err The MySQL startup1shutdo/n and error messages are re)orded in these files: # cat (home(y(lo)s(mysql(mysqld.err %&%8$! !!:4":5" ?nnoDO: Starting shutdo/n... %&%8$! !!:4":&% ?nnoDO: Shutdo/n )ompleted %&%8$! !!:4":&% 1home1y1li eHe)1mys=ld: Shutdo/n Complete %&%8$! !!:4":&% mys=ld ended %&%8$! !!:49:$5 mys=ld started

MySQL Administration Workshop

$% %&%8$! !!:49:$9 ?nnoDO: Started %&%8$! !!:49:$9 Can3t open shared li rary 3udf>eHample.so3 6errno: % 1 home1y1li 1udf>eHample.so: 'ndefined sym ol Xdefault>)harset>in7 %&%8$! !!:49:$9 Can3t open shared li rary 3udf>eHample.so3 6errno: % 1 home1y1li 1udf>eHample.so: 'ndefined sym ol Xdefault>)harset>in7 %&%8$! !!:49:$9 Can3t open shared li rary 3udf>eHample.so3 6errno: % 1 home1y1li 1udf>eHample.so: 'ndefined sym ol Xdefault>)harset>in7 %&%8$! !!:49:$9 Can3t open shared li rary 3udf>eHample.so3 6errno: % 1 home1y1li 1udf>eHample.so: 'ndefined sym ol Xdefault>)harset>in7 1home1y1li eHe)1mys=ld: ready for )onne)tions. +ersion: 3&.%.$$,Jahoo,SMF,log3 so)ket: 31tmp1mys=l.so)k3 port: 55%* Jahoo SMF

# ls -la (home(y(lo)s(mysql( ,r/,r,,r,, ! mys=l users *** Sep !* !4:5$ mys=l.log ,r/,r/,,,, ! mys=l users &*$! Sep $! !!:49 mys=ld.err

Shutdo/n the MySQL server 6daemon7: # yinst sto+ mysql_server yinst: mys=l>server,&.%.$$>!: stopping ...

Startup the MySQL server 6daemon7: # yinst start mysql_server yinst: mys=l>server,&.%.$$>!: starting ...

# ls -la (home(y(lo)s(mysql( ,r/,r,,r,, ! mys=l users "$" Sep $! !$:%$ mys=l.log ,r/,r/,,,, ! mys=l users 448$ Sep $! !$:%$ mys=ld.err

MySQL Administration Workshop

$! # cat (home(y(lo)s(mysql(mysql.lo) ... ... Dilling mys=ld /ith pid 4!5&4 Wait for mys=ld to eHit.. done

2.7
2.7.1

yS!" status chec,= runtime and varia$les in#ormation


yS!" status chec,

There are many /ays to )he)k the MySQL data ase status 2.7.1.1 mysqladmin mys=ladmin is similar to fun)tionality to (ra)le3s ;svrmgrl< and )ould e used for MySQL administration tasks as )reate or drop data ase# flush logs# flush ta les from the )a)he# flush privileges# ping and shutdo/n the MySQL server.

'sage: mysqladmin 0123415S6 command command.... ,N# ,,de ugM... ,f# ,,for)e ,L# ,,help ,C# ,,)ompress ,h# ,,hostMN ,p# ,,pass/ordCM...E ,F ,,portM... ,i# ,,sleepMse) ,r# ,,relative (utput de ug log. (ften this is 3d:t:o#filenameU Don3t ask for )onfirmation on drop data aseP /ith multiple )ommands# )ontinue even if an error o))urs Display this help and eHit 'se )ompression in server1)lient proto)ol Conne)t to host Fass/ord to use /hen )onne)ting to server ?f pass/ord is not given it3s asked from the tty Fort num er to use for )onne)tion GHe)ute )ommands again and again /ith a sleep et/een Sho/ differen)e et/een )urrent and previous values /hen used /ith ,i. Currently /orks only

MySQL Administration Workshop

$$ ,s# ,,silent ,S# ,,so)ketM... ,t# ,,timeoutM... ,u# ,,userMN ,+# ,,version ,/# ,,/aitCMretriesE /ith eHtended,status Silently eHit if one )an3t )onne)t to server So)ket file to use for )onne)tion Timeout for )onne)tion to the mys=ld server 'ser for login if not )urrent user (utput version information and eHit Wait and retry if )onne)tion is do/n

?f MySQL servers is started and a))epts )onne)tions the mys=ladmin )ommand /ill have the follo/ing output: # mysqladmin status 'ptime: &!998% Threads: ! Questions: "** Slo/ =ueries: % (pens: !4* @lush ta les: ! (pen ta les: !5% Queries per se)ond avg: %.%%$

?f MySQL server is not running K the output looks like: # mysqladmin status mys=ladmin: )onne)t to server at 3lo)alhost3 failed error: 3Can3t )onne)t to lo)al MySQL server through so)ket 31tmp1mys=l.so)k3 6$73 Che)k that mys=ld is running and that the so)ket: 31tmp1mys=l.so)k3 eHistsW

To =uery the MySQL server version# one )a use the neHt )ommand: # mysqladmin version mys=ladmin +er 9.% Distri 5.$$.5$# for ,free sd&.! on i59* TCY Datakonsult AO# y Monty Server version Froto)ol version Conne)tion 'A?Y so)ket 'ptime: &.%.$$,Jahoo,SMF,log !% Lo)alhost via 'A?Y so)ket 1tmp1mys=l.so)k & days $% hours $! min 59 se)

MySQL Administration Workshop

$5 Threads: ! Questions: "*" Slo/ =ueries: % (pens: !4* @lush ta les: ! (pen ta les: !5% Queries per se)ond avg: %.%%$ @or a =ui)k )he)k the MySQL server status ;ping< option /ill do a ping and return a)k the result to the STD('T devi)e: # mysqladmin +in) mys=ld is alive ?f the MySQL server is not running the result of the ping /ill e the same as from the ;mys=ladmin status< )ommand: @irst /e /ill shutdo/n MySQL daemon: # mysqladmin shutdown and )he)k the status via the ;ping< option: # mysqladmin +in) mys=ladmin: )onne)t to server at 3lo)alhost3 failed error: 3Can3t )onne)t to lo)al MySQL server through so)ket 31tmp1mys=l.so)k3 6$73 Che)k that mys=ld is running and that the so)ket: 31tmp1mys=l.so)k3 eHistsW To start a)k the MySQL server# you )an use the yinst )ommand option ;start<: # yinst start mysql_server yinst: mys=l>server,&.%.$$>!: starting ... and no/ the ;mys=ladmin ping< su))eeds: # mysqladmin +in) mys=ld is alive

MySQL Administration Workshop

$& 2.7.1.2 mysql ?f MySQL servers is started and a))epts )onne)tions the mys=ladmin )ommand /ill have the follo/ing output: # mysql -u root mysql :eading ta le information for )ompletion of ta le and )olumn names Jou )an turn off this feature to get a =ui)ker startup /ith ,A Wel)ome to the MySQL monitor. Commands end /ith P or Qg. Jour MySQL )onne)tion id is $ to server version: &.%.$$,Jahoo,SMF,log Type 3help3 for help.

mysql' status? mysql +er !$.$$ Distri$ B.8.22# for unkno/n,free sd&.5 6i59*7 Conne)tion id: Aurrent data$aseD Current user: SSL: Current pager: 'sing outfile: Server versionD Froto)ol version: Conne)tion: Client )hara)terset: Server )hara)terset: 'A?Y so)ket: F+timeD $ mysql root.lo)alhost Aot in use less 33 B.8.22-Eahoo-S 2-lo) !% Lo)alhost via 'A?Y so)ket latin! latin! 1tmp1mys=l.so)k 7 min B7 sec

Threads: ! Questions: $% Slo/ =ueries: % (pens: !$ @lush ta les: ! (pen ta les: * Queries per se)ond avg: %.%8%

MySQL Administration Workshop

$4 ?f MySQL server is not running K the output looks like: # mysql -u root 3:S3DB G::(: $%%$: Can3t )onne)t to lo)al MySQL server through so)ket 31tmp1mys=l.so)k3 6$7

2.7.1.7 1S command G+sH When MySQL server is started# there is the ;mys=ld>safe< pro)ess and the ;mys=ld< pro)essesrunning: # +s -au/w * )re+ mysql
mys=l 45*9& %.% %.! *&9 $4$ p% ? !$:%$FM %:%%.%5 1 in1sh 1 home(y($in(mysqld_sa#e ,,datadirM(home(y(var(mysql(data ,,pid, fileM(home(y(var(mysql(mysqld.+id mys=l I7JKI %.% !%.8 !!%$9& $95%9 p% SA !$:%$FM %:%%.&$ 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data mys=l I7JK9 %.% !%.8 !!%$9& $95%9 p% SA !$:%$FM %:%%.%% 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data mys=l I7JKJ %.% !%.8 !!%$9& $95%9 p% ?A !$:%$FM %:%%.%% 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data mys=l I7JKK %.% !%.8 !!%$9& $95%9 p% ?A !$:%$FM %:%%.%% 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data mys=l I7JKL %.% !%.8 !!%$9& $95%9 p% ?A !$:%$FM %:%%.%5 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data mys=l I7JL8 %.% !%.8 !!%$9& $95%9 p% ?A !$:%$FM %:%%.%% 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data mys=l I7K8I %.% !%.8 !!%$9& $95%9 p% SA !$:%$FM %:%%.$" 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data mys=l I7K89 %.% !%.8 !!%$9& $95%9 p% SA !$:%$FM %:%%.$8 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data

MySQL Administration Workshop

$*
mys=l I7K8J %.% !%.8 !!%$9& $95%9 p% ?A !$:%$FM %:%%.%% 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data mys=l I7K8K %.% !%.8 !!%$9& $95%9 p% ?A !$:%$FM %:%%.%% 1 home(y(li$e/ec(mysqld ,, asedirM1home1y KdatadirM1home1y1var1mys=l1data

There is also the pro)ess ?D file 6mys=ld.pid7 )reated for the mys=ld in the 1home1y1var1mys=l1 dire)tory: # ls -la (home(y(var(mysql(mysqld.+id ,r/,r/,,,, ! mys=l mys=l * Sep $! !":!" 1home1y1var1mys=l1mys=ld.pid ?f the MySQL server is not running# then this file is not present: # yinst sto+ mysql_server yinst: mys=l>server,&.%.$$>!: stopping ...

# ls -la (home(y(var(mysql(mysqld.+id ls: 1home1y1var1mys=l1mys=ld.pid: Ao su)h file or dire)tory

# yinst start mysql_server yinst: mys=l>server,&.%.$$>!: starting ...

2.7.2

yS!" runtime in#ormation

The runtime statisti)s a out the MySQL server )ould e revie/ed /ith the follo/ing )ommand:

MySQL Administration Workshop

$" # mysql -u root -e ;show status; 3:S3DB S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S T +aria le>name T +alue T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S T A orted>)lients T% T T A orted>)onne)ts T% T T Oytes>re)eived T 484 T T Oytes>sent T !%*"8 T T Com>admin>)ommands T! T T Com>alter>ta le T% T T Com>analyIe T% T T Com> a)kup>ta le T% T T Com> egin T% T ..... ..... ..... T Ta le>lo)ks>immediate T* T T Ta le>lo)ks>/aited T% T T Threads>)a)hed T% T T Threads>)reated T !5 T T Threads>)onne)ted T! T T Threads>running T! T T 'ptime T &8! T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,S

The MySQL server ;uptime< information: # mysql -u root -e ;show status li,e MF+timeM; 3:S3DB S,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,S T +aria le>name T +alue T S,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,S T 'ptime T 5&5 T S,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,S

MySQL Administration Workshop

$9 The MySQL server ;threads< information: # mysql -u root -e ;show status li,e M3hreadsNM; 3:S3DB S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,S T +aria le>name T +alue T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,S T Threads>)a)hed T% T T Threads>)reated T" T T Threads>)onne)ted T ! T T Threads>running T! T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,S # mysql -u root -e ;show status li,e MAonnectionsM; 3:S3DB S,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,S T +aria le>name T +alue T S,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,S T Conne)tions T8 T S,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,S

2.7.7

yS!" varia$les in#ormation

The )urrent values of the MySQL server )an e listed /ith the follo/ing )ommand: # mysql -u root -e ;show varia$les; 3:S3DB The long list )an also e made more spe)ifi) /ith the follo/ing predi)ate: # mysql -u root -e ;show varia$les li,e MversionNM; 3:S3DB S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T +aria le>name T +alue T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T version T &.%.$$,Jahoo,SMF,log T T version>)omment T Jahoo SMF T T version>)ompile>os T unkno/n,free sd&.5 T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S

MySQL Administration Workshop

$8 Sin)e MySQL version &.%.H you )an )hange the MySQL varia le at run time# /ithout restarting the MySQL deamon: mysql' show varia$les li,e MnetNM? S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,S T +aria le>name T +alue T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,S T net> uffer>length T 9!8$ T T net>read>timeout T 5% T T net>retry>)ount T !%%%%%% T T net>/rite>timeout T *% T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,S & ro/s in set 6%.%! se)7 mysql' set net_write_timeout@7988? Query (D# % ro/s affe)ted 6%.%4 se)7 mysql' show varia$les li,e MnetNM? S,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,S T +aria le>name T +alue T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,S T net> uffer>length T 9!8$ T T net>read>timeout T 5% T T net>retry>)ount T !%%%%%% T T net>/rite>timeout T 5*%% T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,S & ro/s in set 6%.%! se)7

MySQL Administration Workshop

5%

I.1

yS!" master . slave re+lication setu+

The follo/ing eHample outlines the steps re=uired to setup and )onfigure the MySQL master,slave repli)ation. ?n this eHample /e /ill use these t/o @reeOSD ma)hines: a,int.)orp.yahoo.)om , MySQL master 6data ase ;TGSTDO<7 p,int.)orp.yahoo.)om , MySQL slave 6data ase ;TGSTDO<7 master a-int 12D87D28 O $ mysql -u root 3:S3DB mys=l0 sho/ ta lesP S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T Ta les>in>TGSTDO T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T test! T T test$ T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S $ ro/s in set 6%.%% se)7

I.1.1 :na$le the

yS!" re+lication on the master machines

Gdit the 1et)1my.)nf file and make these )hanges: NN 'n)omment these if this server /ill e a master. log, in server,id M!

I.1.2 Pestart the

yS!" server

a-int 12D8ID19 O $ yinst sto+ mysql_server yinst: mys=l>server,&.%.$$>!: stopping ...

MySQL Administration Workshop

5! a-int 12D8ID7I O $ yinst start mysql_server yinst: mys=l>server,&.%.$$>!: starting ...

I.1.7 Ahec, the $inary lo)s )eneration After /e ena led the inary logs generation in the 1et)1my.)nf file 6log, in line7# the inary logs used in the repli)ation should e generated. ?n our test )ase this /as already ena led# so /e have older inary log files# ut still the a,int, in.%!% /as generated after the MySQL server restart a-int 12D8IDB1 O $ ls -la (home(y(var(mysql(data ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ! ! ! ! ! ! ! ! ! ! ! mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l users 8$8 Sep !* !!:!* a,int, in.%%! users 5!! Sep !* !4:!& a,int, in.%%$ users !!49$ Sep $! !!:4* a,int, in.%%5 users "8 Sep $! !!:49 a,int, in.%%& users "8 Sep $! !$:%$ a,int, in.%%4 users "8 Sep $! !":!9 a,int, in.%%* users "8 Sep $! !":55 a,int, in.%%" users !4*5 Sep $" !":&& a,int, in.%%9 users & Sep $" !":&& a,int, in.%%8 users "8 1ct 9 12D89 a-int-$in.818 users !*% ()t * !$:%* a,int, in.indeH

List of all eHisting inary logs 6after the inary logs purge7 are kept in the R, in.indeH file. ?n our )ase this file has the follo/ing entries: a-int 12D89D1L O $ cat (home(y(var(mysql(data(a-int-$in.inde/ .1a,int, .1a,int, .1a,int, .1a,int, .1a,int, .1a,int, .1a,int, .1a,int, .1a,int, .1a,int, in.%%! in.%%$ in.%%5 in.%%& in.%%4 in.%%* in.%%" in.%%9 in.%%8 in.%!%

MySQL Administration Workshop

5$ I.1.B 3a,e $ac,u+ o# the master data$ase We use the mysqldum+ utility to take a hot a)kup of the MySQL data ase ;TGSTDO< # mysqldum+ -u root --add-loc,s --e/tended-insert --#lush-lo)s --loc,ta$les --quic, 3:S3DB ' (var(tm+(3:S3DB-$ac,u+.sql

a-int 12D8LD1B O $ ls -la (var(tm+ ,r/,r,,r,, ! root /heel &8$ 1ct 9 12D8L 3:S3DB-$ac,u+.sql

The a)kup file generated from mysqldum+ )ontaint the SQL statements to )reate the ;TGSTDO< ta les and the ?ASG:T ?AT( ... statements for all ro/s in these ta les a-int 12D8LD1J O $ cat (var(tm+(3:S3DB-$ac,u+.sql N MySQL dump ".! N N Vost: lo)alhost Data ase: TGSTDO N,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, N Server version &.%.$$,Jahoo,SMF,log N N Ta le stru)ture for ta le 3test!3 N C:GATG TAOLG test! 6 id int6!!7# salary int6!!7# department teHt 7P N N Dumping data for ta le 3test!3 N L(CD TAOLGS test! W:?TGP ?ASG:T ?AT( test! +AL'GS 6!%%#A'LL#A'LL7#6!%!#A'LL#A'LL7# 6!%$#A'LL#A'LL7#6!%5#A'LL#A'LL7P 'AL(CD TAOLGSP

MySQL Administration Workshop

55 N N Ta le stru)ture for ta le 3test$3 N C:GATG TAOLG test$ 6 id int6!!7# salary int6!!7# department teHt 7P N N Dumping data for ta le 3test$3 N L(CD TAOLGS test$ W:?TGP ?ASG:T ?AT( test$ +AL'GS 6!%%#A'LL#A'LL7#6!%!#A'LL#A'LL7# 6!%$#A'LL#A'LL7#6!%5#A'LL#A'LL7P 'AL(CD TAOLGSP

I.1.I Ahec, the newly created $inary lo) a#ter the $ac,u+ The mys=ldump )ommand generates a ne/ inary log after its su))ess# /hi)h /ill e the eginning of the slave repli)ation. All the data in the master MySQL data ase ;TGSTDO< /as )aptured in the a)kup file and all the )hanges to the master data ase /ill e re)orded in this 6and the follo/ing7 inary log6s7: a-int 12D8LDBK O $ ls -la (home(y(var(mysql(data ,r/,r/,,,, ! mys=l users 8$8 Sep !* !!:!* a,int, in.%%! ,r/,r/,,,, ! mys=l users 5!! Sep !* !4:!& a,int, in.%%$ ,r/,r/,,,, ! mys=l users !!49$ Sep $! !!:4* a,int, in.%%5 ,r/,r/,,,, ! mys=l users "8 Sep $! !!:49 a,int, in.%%& ,r/,r/,,,, ! mys=l users "8 Sep $! !$:%$ a,int, in.%%4 ,r/,r/,,,, ! mys=l users "8 Sep $! !":!9 a,int, in.%%* ,r/,r/,,,, ! mys=l users "8 Sep $! !":55 a,int, in.%%" ,r/,r/,,,, ! mys=l users !4*5 Sep $" !":&& a,int, in.%%9 ,r/,r/,,,, ! mys=l users & Sep $" !":&& a,int, in.%%8 ,r/,r/,,,, ! mys=l users !!8 ()t * !$:%8 a,int, in.%!% -rw-rw---- 1 mysql users B 1ct 9 12D8L a-int-$in.811 ,r/,r/,,,, ! mys=l users !"* ()t * !$:%8 a,int, in.indeH

MySQL Administration Workshop

5& I.1.9 Ao+y the yS!" master data$ase G3:S3DBH $ac,u+ #rom the master to the slave machines a-int 12D18D2B O $ sc+ (var(tm+(3:S3DB-$ac,u+.sql tri#on&+intD(var(tm+ trifon.p,int3s pass/ord: TGSTDO, a)kup.s=l !%%Z T RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRT &8$ %%:%%

I.1.J Areate slave re+lication account mysql' QPR53 P:2"4AR3415 S"RS:= P:2"4AR3415 A"4:53 15 C.C 31 re+l&;219.1BI.I7.1JB; 4D:534F4:D BE Mre+lM? Query (D# % ro/s affe)ted 6%.%% se)7 mysql' show )rants #or Mre+lM&M219.1BI.I7.1JBM?
S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T Brants for repl.$!*.!&4.45.!"& T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( 3repl3.3$!*.!&4.45.!"&3 ?DGAT?@?GD OJ FASSW(:D 34e)5d 9f*%5f) %53 T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,S ! ro/ in set 6%.%% se)7

slave I.1.K Areate the slave G3:S3DBH which will host the re+licated data$ase #rom the master machine We /ill use the same data ase name# ut this )ould e any data ase name %root&+-int'(root # mysqladmin create 3:S3DB

MySQL Administration Workshop

54 See the list of the eHisting MySQL data ases: %root&+-int'(root # mysqlshow -u root S,,,,,,,,,,,,,,,S T Data ases T S,,,,,,,,,,,,,,,S T TGSTDO T T mys=l T T test T S,,,,,,,,,,,,,,,S %root&+-int'(root # ls -la (var(tm+ ,r/,r,,r,, ! trifon /heel &8$ ()t * !$:!! 3:S3DB-$ac,u+.sql

I.1.L 4m+ort the master data$ase $ac,u+ %root&+-int'(root # mysql -u root 3:S3DB % (var(tm+(3:S3DB$ac,u+.sql

Che)k the master data ase a)kup restore into the slave data ase %root&+-int'(root # mysql -u root -e ;show ta$les; 3:S3DB S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T Ta les>in>TGSTDO T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S T test! T T test$ T S,,,,,,,,,,,,,,,,,,,,,,,,,,,,S

MySQL Administration Workshop

5* %root&+-int'(root # mysql -u root -e ;select count<C> #rom test1?; 3:S3DB S,,,,,,,,,,,,S T )ount6R7 T S,,,,,,,,,,,,S T & T S,,,,,,,,,,,,S %root&+-int'(root # mysql -u root -e ;select count<C> #rom test2?; 3:S3DB S,,,,,,,,,,,,S T )ount6R7 T S,,,,,,,,,,,,S T & T S,,,,,,,,,,,,S I.1.18 :na$le the yS!" slave re+lication

To do that /e have edit the 1et)1my.)nf file and add the MySQL master data ase information NN 'n)omment these if this server /ill e a master. Nlog, in server-id @2

NN :epli)ation master-host @ 219.1BI.I7.1JB master-user @ re+l master-+assword @ re+l master-+ort @ 7789

I.1.11 Pestart the

yS!" slave data$ase server

%root&+-int'(root # yinst sto+ mysql_server

MySQL Administration Workshop

5" yinst: mys=l>server,&.%.!": stopping ... %root&+-int'(root # yinst start mysql_server yinst: mys=l>server,&.%.!": starting ...

I.1.12 Ahec, the

yS!" slave data$ase server lo)

To )onfirm that the MySQL slave repli)ation is running# /e have to )he)k the error log after the mys=ld restart. ?f the repli)ation is running# /e /ill see the appropriate messages. The same is valid in )ase there is an error %root&+-int'(root # cat (home(y(lo)s(mysql(mysqld.err 1home1y1logs1mys=l1mys=ld.err log 8B1889 1BD2BDBK 1home1y1li eHe)1mys=ld: 5ormal shutdown %&!%%* !&:$&:&9 ?nnoDO: Starting shutdo/n... %&!%%* !&:$&:4% ?nnoDO: Shutdo/n )ompleted 8B1889 1BD2BDI8 1home1y1li eHe)1mys=ld: Shutdown Aom+lete 8B1889 1BD2BDI8 mysqld ended %&!%%* !&:$&:4& mys=ld started Warning: ?gnoring user )hange to 3mys=l3 e)ause the user /as set to 3mys=l3 earlier on the )ommand line %&!%%* !&:$&:4& ?nnoDO: Started 1home1y1li eHe)1mys=ld: ready for )onne)tions. +ersion: 3&.%.!",Jahoo,SMF3 so)ket: 31tmp1mys=l.so)k3 port: 55%* %&!%%* !&:$&:4& Slave ?1( thread: )onne)ted to master 3repl.a, int.)orp.yahoo.)om:55%*3# repli)ation started in l og 3@?:ST3 at position & :PP1PD 11B9 3a$le Mtest.t1M doesnMt e/ist 8B1889 1BD2BDIB SlaveD :rror M3a$le Mtest.t1M doesnMt e/istM on query Minsert into t1 values <18=MtMMsetM>M. De#a ult data$aseD MtestM= :rror_codeD 11B9 8B1889 1BD2BDIB :rror runnin) query= slave S!" thread a$orted. Fi/ the +ro$lem= and restart the slave S!" thread with ;S"RS: S3RP3;. Te sto++ed at lo) Ma-int-$in.881M +osition JL

MySQL Administration Workshop

59 As sho/n a ove the repli)ation en)ountered an error. @e/ points from the a ove errors:

the repli)ation started from a-int-$in.881 inary log and position JL the ;test.t!< ta le is the reason for the failure

Vo/ever our slave repli)ation should start from a-int-$in.811 inary log and position B as mentioned efore

To revie/ the inary logs 6/hi)h are inary files and not reada le /ith standard teHt editor7 /e )an use the mysql$inlo) utility a-int 17D7LD7K (home(y($in $ .(mysql$inlo) (home(y(var(mysql(data(aint-$in.811 1RW&%%!8 SGT ..session.maH>insert>delayed>threadsM%R1P N at & N%&!%%* !5:%5:%8 server id ! log>pos & Query thread>idM$ eHe)>timeM% error>)odeM% use mys=lP SGT T?MGSTAMFM!%8"%8$898P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!&41$44.$44.$44.%X ?DGAT?@?GD OJ 3repl3P N at !4% N%&!%%* !5:%4:%5 server id ! log>pos !4% Query thread>idM$ eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%85!%5P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!&41$44.$44.$44.%X ?DGAT?@?GD OJ 3repl3P N at $8* N%&!%%* !5:%*:5$ server id ! log>pos $8* Query thread>idM$ eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%85!8$P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!&4X ?DGAT?@?GD OJ 3repl3P N at &$9 N%&!%%* !5:!*:$" server id ! log>pos &$9 :otate to a,int, in.%!$ pos: &

MySQL Administration Workshop

58 master To vie/ /hi)h is the )urrent inary log and its position# /e )an use the SH1T RS3:P S3R3FS )ommand mysql' show master status? S,,,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,S T @ile T Fosition T Oinlog>do>d T Oinlog>ignore>d T S,,,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,S T a,int, in.%!& T "&! T T T S,,,,,,,,,,,,,,,S,,,,,,,,,,S,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,S ! ro/ in set 6%.%% se)7 The )urrent inary log in the a,int, in.%!& and its position is "&! slave To vie/ the slave repli)ation status /e )an use the SH1T S"RS: S3R3FS )ommand mysql' show slave statusUQ RRRRRRRRRRRRRRRRRRRRRRRRRRR !. ro/ RRRRRRRRRRRRRRRRRRRRRRRRRRR Master>Vost: a,int.)orp.yahoo.)om Master>'ser: repl Master>Fort: 55%* Conne)t>retry: *% aster_"o)_FileD a-int-$in.81B Pead_ aster_"o)_2osD JB1 :elay>Log>@ile: p,int,relay, in.%$$ :elay>Log>Fos: !!8 :elay>Master>Log>@ile: a,int, in.%%! Slave>?(>:unning: Jes Slave>SQL>:unning: Ao :epli)ate>do>d : :epli)ate>ignore>d : Last>errno: !!&* "ast_errorD :rror M3a$le Mtest.t1M doesnMt e/istM on query Minsert into t1 values <18=MtMMsetM>M. De#ault data$aseD MtestM GHe)>master>log>pos: "8 :elay>log>spa)e: !9$99

MySQL Administration Workshop

&% the )urrent inary logs on the master ma)hine a-int 1BD2LD1K (home(y($in $ ls -la (home(y(var(mysql(data( ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l users 8$8 Sep !* !!:!* a,int, in.%%! users 5!! Sep !* !4:!& a,int, in.%%$ users !!49$ Sep $! !!:4* a,int, in.%%5 users "8 Sep $! !!:49 a,int, in.%%& users "8 Sep $! !$:%$ a,int, in.%%4 users "8 Sep $! !":!9 a,int, in.%%* users "8 Sep $! !":55 a,int, in.%%" users !4*5 Sep $" !":&& a,int, in.%%9 users & Sep $" !":&& a,int, in.%%8 users !!8 ()t * !$:%8 a,int, in.%!% users &*9 ()t * !5:!* a,int, in.%!! users *** ()t * !5:5* a,int, in.%!$ users !%9! ()t * !&:%" a,int, in.%!5 users "&! ()t * !&:$& a,int, in.%!& users $$& ()t * !&:!! a,int, in.indeH

a-int 1BD2LD89 (home(y($in $ .(mysql$inlo) (home(y(var(mysql(data(aint-$in.811 1RW&%%!8 SGT ..session.maH>insert>delayed>threadsM%R1P N at & N%&!%%* !5:%5:%8 server id ! log>pos & Query thread>idM$ eHe)>timeM% error>)odeM% use mys=lP SGT T?MGSTAMFM!%8"%8$898P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!&41$44.$44.$44.%X ?DGAT?@?GD OJ 3repl3P N at !4% N%&!%%* !5:%4:%5 server id ! log>pos !4% Query thread>idM$ eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%85!%5P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!&41$44.$44.$44.%X ?DGAT?@?GD OJ 3repl3P N at $8* N%&!%%* !5:%*:5$ server id ! log>pos $8* Query thread>idM$ eHe)>timeM% error>)odeM%

MySQL Administration Workshop

&! SGT T?MGSTAMFM!%8"%85!8$P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!&4X ?DGAT?@?GD OJ 3repl3P N at &$9 N%&!%%* !5:!*:$" server id ! log>pos &$9 :otate to a,int, in.%!$ pos: &

a-int 1BD2LD12 (home(y($in $ .(mysql$inlo) (home(y(var(mysql(data(aint-$in.812 1RW&%%!8 SGT ..session.maH>insert>delayed>threadsM%R1P N at & N%&!%%* !5:$&:$4 server id ! log>pos & Query thread>idM" eHe)>timeM% error>)odeM% use mys=lP SGT T?MGSTAMFM!%8"%8&$*4P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!&4X ?DGAT?@?GD OJ 3repl3P N at !5* N%&!%%* !5:$4:%& server id ! log>pos !5* Query thread>idM" eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8&5%&P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!"&X ?DGAT?@?GD OJ 3repl3P N at $*9 N%&!%%* !5:5$:5! server id ! log>pos $*9 Query thread>idM!" eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8&"4!P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!"&X ?DGAT?@?GD OJ 3repl3P N at &%% N%&!%%* !5:5*:!& server id ! log>pos &%% Query thread>idM!" eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8&8"&P delete from user /here host M 3p,int.)orp.yahoo.)om3P N at &99 N%&!%%* !5:5*:$* server id ! log>pos &99 Query thread>idM!" eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8&89*P delete from user /here host M 3$!*.!&4.45.!&41$44.$44.$44.%3P

MySQL Administration Workshop

&$ N at 49& N%&!%%* !5:5*:&8 server id ! log>pos 49& eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%84%%8P delete from user /here host M 3$!*.!&4.45.!&43P Query thread>idM!"

a-int 1BD2LD78 (home(y($in $ .(mysql$inlo) (home(y(var(mysql(data(aint-$in.817 1RW&%%!8 SGT ..session.maH>insert>delayed>threadsM%R1P N at & N%&!%%* !5:&4:49 server id ! log>pos & Start: inlog v 5# server v &.%.$$,Jahoo,SMF,log )reated %&!%%* !5:&4:49 at startup N at "8 N%&!%%* !5:&":&$ server id ! log>pos "8 Query thread>idM5 eHe)>timeM% error>)odeM% use mys=lP SGT T?MGSTAMFM!%8"%84**$P delete from user /here user M 3repl3P N at !4! N%&!%%* !5:&9:4& server id ! log>pos !4! Query thread>idM5 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%84"5&P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!"&X ?DGAT?@?GD OJ 3repl3P N at $95 N%&!%%* !5:4%:%$ server id ! log>pos $95 Query thread>idM5 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%849%$P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.Xp, intX ?DGAT?@?GD OJ 3repl3P N at &%* N%&!%%* !5:4%:58 server id ! log>pos &%* Query thread>idM5 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%84958P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.Xa, intX ?DGAT?@?GD OJ 3repl3P N at 4$8 N%&!%%* !&:%!:$9 server id ! log>pos 4$8 Query thread>idM5 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8*&99P delete from user /here user M 3repl3P

MySQL Administration Workshop

&5 N at *%! N%&!%%* !&:%5:58 server id ! log>pos *%! Query thread>idM!8 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8**!8P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.45.!"&X ?DGAT?@?GD OJ 3repl3P N at "55 N%&!%%* !&:%4:$9 server id ! log>pos "55 Query thread>idM!8 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8*"$9P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.Xp, int.)orp.yahoo.)omX ?DGAT?@?GD OJ 3repl3P N at 9"! N%&!%%* !&:%":&4 server id ! log>pos 9"! Query thread>idM!8 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8*9*4P delete from user /here user M 3repl3P N at 8&5 N%&!%%* !&:%":&8 server id ! log>pos 8&5 Query thread>idM!8 eHe)>timeM! error>)odeM% SGT T?MGSTAMFM!%8"%8*9*8P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.Xp, int.)orp.yahoo.)omX ?DGAT?@?GD OJ 3repl3P

To demonstrate the staled master,slave repli)ation resolution# /e /ill make some )hanges on the master ma)hine first and then resolve the slave repli)ation failure and in)lude the already made )hanges sin)e the last slave data ase update from the master data ase a)kup master a-int 1BD72D17 (home(y($in $ mysql -u root 3:S3DB mysql' desc test1? S,,,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,S,,,,,S,,,,,,,,,,,,S,,,,,,,,,S T @ield T Type T Aull T Dey T Default T GHtra T S,,,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,S,,,,,S,,,,,,,,,,,,,S,,,,,,,,S T id T int6!!7 T JGS T T A'LL T T T salary T int6!!7 T JGS T T A'LL T T T department T teHt T JGS T T A'LL T T S,,,,,,,,,,,,,,,,,S,,,,,,,,,,,S,,,,,,,,S,,,,,,S,,,,,,,,,,,,S,,,,,,,,S

MySQL Administration Workshop

&& mysql' insert into test1 values <188= 2I888= M Query (D# ! ro/ affe)ted 6%.$& se)7 mysql' insert into test1 values <181= 7I888= M Query (D# ! ro/ affe)ted 6!.!4 se)7 mysql' commit? Query (D# % ro/s affe)ted 6%.%% se)7 mysql' connect mysql? :eading ta le information for )ompletion of ta le and )olumn names Jou )an turn off this feature to get a =ui)ker startup /ith ,A Conne)tion id: $& Current data ase: mys=l mysql' QPR53 all +rivile)es 15 C.C 31 testd$l&;aint.cor+.yahoo.com; 4D:534F4:D BE MtestM? Query (D# % ro/s affe)ted 6%.%% se)7 mysql' QPR53 all +rivile)es 15 C.C 31 testd$2&;aint.cor+.yahoo.com; 4D:534F4:D BE Mtest1M? Query (D# % ro/s affe)ted 6%.%% se)7 mysql' connect 3:S3DB :eading ta le information for )ompletion of ta le and )olumn names Jou )an turn off this feature to get a =ui)ker startup /ith ,A Conne)tion id: $4 Current data ase: TGSTDO F3M>? F3M>?

MySQL Administration Workshop

&4 mysql' insert into test1 values <182= BI888= M Query (D# ! ro/ affe)ted 6%.%% se)7 mysql' insert into test1 values <187= BI888= M Query (D# ! ro/ affe)ted 6%.%$ se)7 mysql' commit? Query (D# % ro/s affe)ted 6%.%% se)7 F3M>? F3M>?

Ao/ the position in the master inary log /as moved ahead to !&&4 mysql' show master status? S,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,S T @ile T Fosition T Oinlog>do>d T Oinlog>ignore>d T S,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,S T a,int, in.%!& T !&&4 T T T S,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,S mysql' e/it The )hanges on the MySQL master data ase are no/ re)orded in the a,int, in.%!& inary log a-int 1BD7ID8I (home(y($in $ .(mysql$inlo) (home(y(var(mysql(data(aint-$in.81B .. .. N at &&$ N%&!%%* !&:$$:&4 server id ! log>pos &&$ Query eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8""*4P grant all privileges on TGSTDO.R to repl.X$!*.!&4.4%.!"&XP thread>idM$

MySQL Administration Workshop

&* N at 454 N%&!%%* !&:$$:4* server id ! log>pos 454 Query thread>idM$ eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8"""*P update user set pass/ordMFASSW(:D63repl37 /here userM3repl3P N at *5% N%&!%%* !&:$&:54 server id ! log>pos *5% Query thread>idM$ eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"%8"9"4P B:AAT :GFL?CAT?(A SLA+G# :GFL?CAT?(A CL?GAT (A R.R T( repl.X$!*.!&4.4%.!"&XP # at JB1 #8B1889 1BD72DBK server id 1 lo)_+os JB1 !uery thread_id@27 e/ec_time@8 error_code@8 use 3:S3DB? S:3 34 :S3R 2@18LJ8LK79K? insert into test1 values <188= 2I888= M F3M>? # at K22 #8B1889 1BD72DIJ server id 1 lo)_+os K22 !uery thread_id@27 e/ec_time@8 error_code@8 S:3 34 :S3R 2@18LJ8LK7JJ? insert into test1 values <181= 7I888= M F3M>? # at L87 #8B1889 1BD7BD1K server id 1 lo)_+os L87 !uery thread_id@2B e/ec_time@8 error_code@8 use mysql? S:3 34 :S3R 2@18LJ8LKBIK? QPR53 all +rivile)es 15 C.C 31 testd$l&;a-int.cor+.yahoo.com; 4D:534F4:D BE MtestM? # at 1821 #8B1889 1BD7BD2J server id 1 lo)_+os 1821 !uery thread_id@2B e/ec_time@8 error_code@8 S:3 34 :S3R 2@18LJ8LKB9J? QPR53 all +rivile)es 15 C.C 31 testd$2&;a-int.cor+.yahoo.com; 4D:534F4:D BE Mtest1M?

MySQL Administration Workshop

&" # at 11B8 #8B1889 1BD7BDI7 server id 1 lo)_+os 11B8 !uery thread_id@2I e/ec_time@8 error_code@8 use 3:S3DB? S:3 34 :S3R 2@18LJ8LKBL7? insert into test1 values <182= BI888= M F3M>? # at 1221 #8B1889 1BD7ID81 server id 1 lo)_+os 1221 !uery thread_id@2I e/ec_time@8 error_code@8 S:3 34 :S3R 2@18LJ8LKI81? insert into test1 values <187= BI888= M F3M>?

To fiH the MySQL slave repli)ation errors# /e have to first stop the slave repli)ation mysql' sto+ slave? Query (D# % ro/s affe)ted 6%.%! se)7 Then /e roll for/ard the slave repli)ation from the a-int-$in.881= +osition JL to the a-int-$in.811= +osition JB1 mysql' chan)e master to master_lo)_#ile@Ma-int-$in.81BM= master_lo)_+os@JB1? Query (D# % ro/s affe)ted 6%.%$ se)7 Ao/ start the slave repli)ation from the ne/ master inary log and position mysql' start slave? Query (D# % ro/s affe)ted 6%.%% se)7 Che)k again the slave repli)ation status

MySQL Administration Workshop

&9 mysql' show slave statusUQ RRRRRRRRRRRRRRRRRRRRRRRRRRR !. ro/ RRRRRRRRRRRRRRRRRRRRRRRRRRR Master>Vost: a,int.)orp.yahoo.)om Master>'ser: repl Master>Fort: 55%* Conne)t>retry: *% aster_"o)_FileD a-int-$in.81B Pead_ aster_"o)_2osD 1782 :elay>Log>@ile: p,int,relay, in.%%! :elay>Log>Fos: *%4 :elay>Master>Log>@ile: a,int, in.%!& Slave_41_Punnin)D Ees Slave_S!"_Punnin)D Ees :epli)ate>do>d : :epli)ate>ignore>d : Last>errno: % Last>error: Skip>)ounter: % GHe)>master>log>pos: !5%$ :elay>log>spa)e: *%4 ! ro/ in set 6%.%% se)7 The slave repli)ation /as for/arded to the ne/ master inary log and position and the oth repli)ation threads 6Slave>?(>:unning and Slave>SQL>:unning7 are /orking

To validate if all the data from the master is no/ availa le in the slave data ase mysql' connect 3:S3DB? :eading ta le information for )ompletion of ta le and )olumn names Jou )an turn off this feature to get a =ui)ker startup /ith ,A Conne)tion id: *" Current data ase: TGSTDO mysql' select C #rom test1?

MySQL Administration Workshop

&8 S,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,S T id T salary T department T S,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,S T !%% T A'LL T A'LL T T !%! T A'LL T A'LL T T !%$ T A'LL T A'LL T T !%5 T A'LL T A'LL T T !%$ T &4%%% T M@T T T !%5 T &4%%% T M@T T T !%% T $4%%% T M@T T T !%! T 54%%% T M@T T T !%$ T &4%%% T M@T T T !%5 T &4%%% T M@T T S,,,,,,S,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,S !% ro/s in set 6%.%% se)7 Ao/ the ro/s added to the master data ase efore eHist in the slave data ase Another useful )ommand /hen trou leshooting or setting master,slave repli)ation is the follo/ing )ommand S:3 Q"1BR" S!"_S"RS:_SV42_A1F53:P @ n This )ommand skip the neHt n events from the master on the slave. This is useful for re)overing from repli)ation stops )aused y a statement. This statement is valid only /hen the slave thread is not running. (ther/ise# it produ)es an error. To demonstrate the use of this )ommand /e /ill use the follo/ing demo )urrent slave: mysql' show slave statusUQ RRRRRRRRRRRRRRRRRRRRRRRRRRR !. ro/ RRRRRRRRRRRRRRRRRRRRRRRRRRR Master>Vost: a,int.)orp.yahoo.)om Master>'ser: repl Master>Fort: 55%* Conne)t>retry: *% Master>Log>@ile: a,int, in.%!&

MySQL Administration Workshop

4% :ead>Master>Log>Fos: !5%$ :elay>Log>@ile: p,int,relay, in.%%! :elay>Log>Fos: *%4 :elay>Master>Log>@ile: a,int, in.%!& Slave>?(>:unning: Jes Slave>SQL>:unning: Jes :epli)ate>do>d : :epli)ate>ignore>d : Last>errno: % Last>error: Skip>)ounter: % GHe)>master>log>pos: !5%$ :elay>log>spa)e: *%4 ! ro/ in set 6%.%% se)7 mysql' sto+ slave? Query (D# % ro/s affe)ted 6%.%! se)7

master a-int 1ID82D1I (home(y($in $ mysql -u root 3:S3DB mysql' create ta$le test7 <id inte)er>? Query (D# % ro/s affe)ted 6%.%! se)7 mys=l0 update test! set salary M salary R !.4P Query (D# & ro/s affe)ted 6%.%% se)7 :o/s mat)hed: 9 Changed: & Warnings: % mys=l0 )ommitP Query (D# % ro/s affe)ted 6%.%% se)7 )he)k the master inary log: a-int 1ID8KD1J (home(y($in $ .(mysql$inlo) (home(y(var(mysql(data(aint-$in.81B ..

MySQL Administration Workshop

4! .. N at 1782 N%&!%%* !4:%*:$! server id ! log>pos !5%$ eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"!%%59!P create ta$le test7 <id inte)er>? N at 17J8 N%&!%%* !4:%8:4* server id ! log>pos !5"% eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"!%%48*P u+date test1 set salary @ salary C 1.I? Query thread>idM$8

Query

thread>idM5!

slave To introdu)e an error on the slave repli)ation ma)hine# /e /ill skip the neHt entry in the )urrent master inary log a,int, in.%!& 6position !5%$7 mysql' set )lo$al sql_slave_s,i+_counter @ 1? Query (D# % ro/s affe)ted 6%.%% se)7 and restart the MySQL slave repli)ation mysql' start slave? Query (D# % ro/s affe)ted 6%.%! se)7 (n)e /e )he)k the slave repli)ation status# /e )an see the position !5%$ /as skipped and position !5"% /as applied. Ao/ the repli)ation is the on the !&&4 position mysql' show slave statusUQ RRRRRRRRRRRRRRRRRRRRRRRRRRR !. ro/ RRRRRRRRRRRRRRRRRRRRRRRRRRR Master>Vost: a,int.)orp.yahoo.)om Master>'ser: repl Master>Fort: 55%* Conne)t>retry: *%

MySQL Administration Workshop

4$ aster_"o)_FileD a-int-$in.81B Pead_ aster_"o)_2osD 1BBI :elay>Log>@ile: p,int,relay, in.%%! :elay>Log>Fos: "99 :elay>Master>Log>@ile: a,int, in.%!& Slave_41_Punnin)D Ees Slave_S!"_Punnin)D Ees :epli)ate>do>d : :epli)ate>ignore>d : Last>errno: % Last>error: Skip>)ounter: % GHe)>master>log>pos: !&&4 :elay>log>spa)e: "99 ! ro/ in set 6%.%% se)7

?n order to introdu)e a master,slave repli)ation error# /e /ill insert re)ords in the test5 ta le on the master. This ta le doesn3t eHists on the slave as seen from the eHamples a ove# so the slave repli)ation should fail at this point master mysql' insert into test7 values <188>? Query (D# ! ro/ affe)ted 6%.%% se)7 mysql' insert into test7 values <181>? Query (D# ! ro/ affe)ted 6%.%% se)7 mysql' insert into test7 values <182>? Query (D# ! ro/ affe)ted 6%.%% se)7 mysql' insert into test7 values <187>? Query (D# ! ro/ affe)ted 6%.%% se)7

MySQL Administration Workshop

45 mysql' insert into test7 values <18B>? Query (D# ! ro/ affe)ted 6!.!8 se)7 mysql' insert into test2 values <18J= BI888= MSDSM>? Query (D# ! ro/ affe)ted 6%.%% se)7 mysql' commit? Query (D# % ro/s affe)ted 6%.%% se)7

slave

mysql' show slave statusUQ RRRRRRRRRRRRRRRRRRRRRRRRRRR !. ro/ RRRRRRRRRRRRRRRRRRRRRRRRRRR Master>Vost: a,int.)orp.yahoo.)om Master>'ser: repl Master>Fort: 55%* Conne)t>retry: *% aster_"o)_FileD a-int-$in.81B Pead_ aster_"o)_2osD 1JK8 :elay>Log>@ile: p,int,relay, in.%%! :elay>Log>Fos: "99 :elay>Master>Log>@ile: a,int, in.%!& Slave_41_Punnin)D Ees Slave_S!"_Punnin)D 5o :epli)ate>do>d : :epli)ate>ignore>d : Last>errno: !!&* "ast_errorD :rror M3a$le M3:S3DB.test7M doesnMt e/istM on query Minsert into test7 values <188>M. De#ault data$aseD M3:S3DB3 Skip>)ounter: % GHe)>master>log>pos: !&&4 :elay>log>spa)e: !!$5 ! ro/ in set 6%.%% se)7

MySQL Administration Workshop

4& As /e )an see the Slave>SQL>:unning thread is not running e)ause the master transa)tion )annot e )ompleted on the slave data ase. To fiH this pro lem /e have t/o )hoi)es:

)reate the test5 ta le and restart the repli)ation skip the transa)tions# /hi)h refer to the test5 ta le

?n the sake of demonstrating the S:3 Q"1BR" S!"_S"RS:_SV42_A1F53:P @ n )ommand /e /ill use the se)ond option. mysql' sto+ slave? Query (D# % ro/s affe)ted 6%.%% se)7

master When revie/ing the inary log on the master /e )an see that up to position !"9% all transa)tion involve the test5 ta le. a-int 1ID29D18 (home(y($in $ .(mysql$inlo) (home(y(var(mysql(data(aint-$in.81B .. .. ... N at !&&4 N%&!%%* !4:$5:$5 server id ! log>pos !&&4 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"!%!&%5P insert into test5 values 6!%%7P N at !4!$ N%&!%%* !4:$5:$* server id ! log>pos !4!$ eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"!%!&%*P insert into test5 values 6!%!7P

Query

thread>idM5&

Query

thread>idM5&

MySQL Administration Workshop

44 N at !4"8 N%&!%%* !4:$5:$9 server id ! log>pos !4"8 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"!%!&%9P insert into test5 values 6!%$7P N at !*&* N%&!%%* !4:$5:5! server id ! log>pos !*&* eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"!%!&!!P insert into test5 values 6!%57P N at !"!5 N%&!%%* !4:$5:5* server id ! log>pos !"!5 eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"!%!&!*P insert into test5 values 6!%&7P # at 1JK8 N%&!%%* !4:$&:4" server id ! log>pos !"9% eHe)>timeM% error>)odeM% SGT T?MGSTAMFM!%8"!%!&8"P insert into test$ values 6!%"# &4%%%# 3SDS37P To skip these test5 transa)tions mysql' S:3 Q"1BR" S!"_S"RS:_SV42_A1F53:P @ I? or mysql' chan)e master to master_lo)_#ile@Ma-int-$in.81BM= master_lo)_+os@1JK8? Query thread>idM5&

Query

thread>idM5&

Query

thread>idM5&

Query

thread>idM5&

mysql' start slave?

MySQL Administration Workshop

4*

I.2 2ur)in) the master $inary lo)s


To purge the master inary logs /e have to find# /hi)h is the )urrent master inary log on the master data ase and /hi)h is the latest master inary log used on ea)h slave data ase. All inary logs older than the )urrent inary log are safe to e deleted a-int 1BDIKD77 (home(y($in $ mysql -u root mysql mysql' show master status? S,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,S T @ile T Fosition T Oinlog>do>d T Oinlog>ignore>d T S,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,S T a,int, in.%!& T !5%$ T T T S,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,,,,,,,,,,S ! ro/ in set 6%.%% se)7

slave mysql' show slave statusUQ RRRRRRRRRRRRRRRRRRRRRRRRRRR !. ro/ RRRRRRRRRRRRRRRRRRRRRRRRRRR Master>Vost: a,int.)orp.yahoo.)om Master>'ser: repl Master>Fort: 55%* Conne)t>retry: *% aster_"o)_FileD a-int-$in.81B :ead>Master>Log>Fos: !5%$ :elay>Log>@ile: p,int,relay, in.%%! :elay>Log>Fos: *%4 :elay>Master>Log>@ile: a,int, in.%!& Slave>?(>:unning: Jes Slave>SQL>:unning: Jes :epli)ate>do>d : :epli)ate>ignore>d : Last>errno: %

MySQL Administration Workshop

4" Last>error: Skip>)ounter: % GHe)>master>log>pos: !5%$ :elay>log>spa)e: *%4 ! ro/ in set 6%.%% se)7

the )urrent inary logs: a-int 1BD2LD1K (home(y($in $ ls -la (home(y(var(mysql(data( ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ,r/,r/,,,, ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l mys=l users 8$8 Sep !* !!:!* a,int, in.%%! users 5!! Sep !* !4:!& a,int, in.%%$ users !!49$ Sep $! !!:4* a,int, in.%%5 users "8 Sep $! !!:49 a,int, in.%%& users "8 Sep $! !$:%$ a,int, in.%%4 users "8 Sep $! !":!9 a,int, in.%%* users "8 Sep $! !":55 a,int, in.%%" users !4*5 Sep $" !":&& a,int, in.%%9 users & Sep $" !":&& a,int, in.%%8 users !!8 ()t * !$:%8 a,int, in.%!% users &*9 ()t * !5:!* a,int, in.%!! users *** ()t * !5:5* a,int, in.%!$ users !%9! ()t * !&:%" a,int, in.%!5 users "&! ()t * !&:$& a,int, in.%!& users $$& ()t * !&:!! a,int, in.indeH

mysql' +ur)e master lo)s to Ma-int-$in.81BM? Query (D# % ro/s affe)ted 6%.%% se)7 after the purge# all inary logs older than a,int, in.%!& are deleted a-int 1ID82D82 (home(y($in $ ls -la (home(y(var(mysql(data ,r/,r/,,,, ! mys=l users !5%$ ()t * !&:54 a,int, in.%!& ,r/,r/,,,, ! mys=l users !* ()t * !4:%! a,int, in.indeH

MySQL Administration Workshop

Anda mungkin juga menyukai