Tải bản đầy đủ (.pdf) (443 trang)

IT training learning MySQL and MariaDB heading in the right direction with MySQL and MariaDB dyer 2015 04 19 1

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.34 MB, 443 trang )



LearningMySQLandMariaDB
RussellJ.T.Dyer

Beijing•Cambridge•Farnham•Köln•Sebastopol•Tokyo


ToFortunataSerio,mymother,whogavemelife,taughtmetobekindandloving,andto
speak—whichisaprecursortobeingawriter.
AndtoAndrewGambos,whohadthethanklessjobofbeingmystepfather,buttaughtme
howtoassertmyselfinlifeandinmycareer.



SpecialUpgradeOffer
Ifyoupurchasedthisebookdirectlyfromoreilly.com,youhavethefollowingbenefits:
DRM-freeebooks—useyourebooksacrossdeviceswithoutrestrictionsorlimitations
Multipleformats—useonyourlaptop,tablet,orphone
Lifetimeaccess,withfreeupdates
Dropboxsyncing—yourfiles,anywhere
Ifyoupurchasedthisebookfromanotherretailer,youcanupgradeyourebooktotake
advantageofallthesebenefitsforjust$4.99.Clickheretoaccessyourebookupgrade.
Pleasenotethatupgradeoffersarenotavailablefromsamplecontent.



Foreword
BeforeyoubegintoreadthemainchaptersofthisbooktolearnaboutMySQLand
MariaDB,itmightbeusefultounderstandwhatweweretryingtoaccomplishwhenwe
firstcreatedMySQLabout20yearsagoandMariaDBabout5yearsago,aswellasthe


currentstateofthesedatabasesystemsandmyexpectationsofthemgoingforward.And
I’dliketoencourageyouinyourdecisiontolearnthesedatabasesystemsandtoassure
youthattheywillbeinuseforalongtimeandthatyouwillbenefitfromthetimeand
energyyouputintoreadingthisbookandlearningwhatithastoteachyou.


OriginsofMySQL
WhenmybusinesspartnerDavidAxmarkandIstartedMySQL,thereweren’tanygood,
free,opensourcedatabasesystems.TherewasmSQL,whichwasn’topensource,butit
inspiredustocreateanewdatabasesystemforourclients,whichwouldlaterbecome
MySQL.WehadnoplanstodoanythingmorewiththisembryoofMySQLotherthan
satisfytheneedsofourclients.Wewerelearning,discovering,andcreatingoutof
practicalconcernsandneeds,muchasyoumightandperhapsshouldbedoingasareader
ofthisbookandanewcomertoMySQLandMariaDB.
Althoughwehadaccomplishedourtaskincreatingastraightforwarddatabasetomeetour
requirements,itwasn’tlongbeforewenoticedthatthereweremanyotherorganizations
thatwerelookingforasolutionsimilartowhatwehadalreadydeveloped.Sowedecided
tomakethesoftwareavailabletothepublicandwenameditMySQL.
Partofourmotivationfordoingthiswasthatwefeltthatitwasawayinwhichwecould
givesomethingbacktotheopensourcecommunitythatwouldbeveryuseful.Mostopen
sourceprojectsatthattimeweren’tasuseful.Wewantedtomaketheworldalittlebetter
—wehadnoideaatthattimehowmuchofanimpactMySQLwouldhaveontheworld.
Atthesametime,wewerehopingthatbygoingpublicwiththesoftware,itmightfinance
furtherdevelopmentofMySQLforaslongaswemightwant.Wehadexpectationsof
gettingrichfromMySQL.Wehopedonlytobeabletoworkfull-timeonthisproject
becausewebelievedinit.Theresult,though,wasthatwecontributedmuchtotheworld
—muchmorethanwethoughtpossible.
Giventhefactthatover80%ofthewebsitesintheworldarenowrunningonMySQL,
onecouldeasilyarguethatweacceleratedthegrowthoftheinternetandalmost
everythingthathasgrownoutofit.Theimpactit’shadisimmeasurable.Manyofthesites

andbusinessesthathavebeensuccessful,includingtheonesthatarenowhuge,probably
wouldneverhavestartedifitwerenotforMySQLbeingfreeanddependable.Atthat
time,thosefoundersandstartupcompaniesjustdidn’thavethefinancialresourcestostart
theirsites.Thecostofcommercialdatabasesoftwarewasabarriertosomeofthemost
creativeweb-basedorganizationsbeinglaunched,includingorganizationslikeGoogle,
Wikipedia,andFacebook.Plus,thecommercialdatabasesystemsposedotherproblems
forstartupsofthattime.First,theyweretooslow—theyweren’toptimizedfortheWeb
andthatwascriticalfororganizationslikethese.Thecommecialalternativeswerealsotoo
difficulttouseandmanage,requiringhigherpaiddevelopers.
Becauseofthesefactors,wewereabletogivefledglingorganizationswhattheyneededto
becomethesignificantcomponentsoftheInternetandamajorpartofthelivesofmost
peopleintheworldtoday.Wewereacriticalcomponentofthedevelopmentofthe
Internetandwestillare.There’snothingtoindicatethatwewon’tcontinuetobeso.The
growthofMySQLandespeciallyofMariaDBisincreasing.It’snotdecreasingassome
peopleexpectedwiththeintroductionofnewdatabasessystemsandmethodssuchas
NoSQL.
MySQLbecameadominantdatabasesystemlongago.Oncesomethingbecomes
dominant,it’sdifficulttoreplaceit.Evenifsomethingbettercomesalong,peopleprefer
what’salreadyfamiliartothemandwhattheyalreadyknowandareusing.Forsomething


toreplaceMySQLasthedominantopensourcedatabase,itwouldhavetobenotonly
criticallybetter,butalsoofferawayforpeopletomigratewithoutmucheffort,and
withoutwastingalloftheknowledgetheyaccumulatedfromtheircurrentsystem.Thisis
whyMariaDBcanreplaceMySQL:it’sbasicallythesamething,butwithmorefeatures
andmorepotentialforthefuture.


StateofMySQLandMariaDB
MySQLandMariaDBaren’tperfect—nodatabaseisthat,norwilleverbethat—but

MySQLandMariaDBaregoodenoughformostpeopleandthey’reexcellentinmany
ways.Thebalancewestriveforistodevelopadatabasesystemthatworkseasilyonthe
Webandhasoneofthefastestconnectors.Thankstothefactthatwe’reusingthreads,we
canhandlemuchhigherloadsthanotherdatabasesystems.Weusedsomeofthemost
advancedtechnologiesavailablewhenwestartedMySQLandwehavealwaysstrivento
adapttonewhardwareandtooptimizethesoftwareforallcommonlyusedsystemsand
methodsofdeployment.Becausewe’recontinuouslyimprovingthesoftware,wecanhave
anewreleaseeachmonthforthecommunityeditionandwecanhaveanewversionevery
year.That’sanindicationthatthingsarehappeningandimprovingregularly.
AssomeonelearningandintendingtouseMySQLandMariaDB,youcantakecomfortin
thatwearealwaysimprovingandadjustingforachangingenvironment.Youcancounton
usforthefuture.Ithinkthat’sthemainthing:peoplelikethattheycandependonus.
Althoughitmaybefunandexcitingtolearnsomethingnew,afterawhileitcanbecome
tiresometohavetolearnatotallynewsystemeverycoupleofyears.Youwon’thavetodo
thatwithMySQLandMariaDB.
Imentionedbeforeabouthowdifficultitistosupplantadominantsoftware.Inthecaseof
MariaDB,it’snotmuchofachangeinpracticeforthosewhohavebeenusingMySQL.
Asaresult,mostpeoplecanmigratetoMariaDBwithouttheusualobstacles,buttheycan
takeadvantageofthenewfeaturesincludedinMariaDBandtheonesthatareplanned
whenthey’readded.MariaDBisrelevantbecausewecontinuetomakeimprovementsand
wecareaboutgivingdeveloperswhattheyneedtogetthemostoutoftheirdatabases.


BeyondtheServer
Inadditiontowebusage,MySQLandMariaDBcanbeusedforstand-aloneapplications,
embeddedwithothersoftware.EmbeddedMySQLandMariaDBaregrowingmorethan
ever.Manyapplicationsaremovingtocloudenvironments,butdatabasesystemsthat
manybusinessesusedinthepastaretypicallytooexpensivetouseinacloud
environment.Asaresult,theyneedaninexpensivedatabasesystemthatiseasilydeployed
inacloudenvironment.Forthissituation,MySQLandMariaDBaretheobviouschoices.

Theuseofmobiledevicesandwebsitesandapplicationsthroughmobiledeviceshas
increaseddramatically;forsomesites,itnowexceedsaccessandusagethroughdesktop
computers.Forsitesandapplicationsthatrunonmobiledevicesanduseadatabase
locatedinthecloudorinhouse,we’rethebestchoiceamongalltheopensourceand
commercialdatabasesystems.Wehavethebestscale-outtechnologiesforwhenyoursite
orapplicationexperiencesmajorspikesintrafficorrapidgrowthinbusiness.Withthe
encryptionthatwe’readdinginversion10.1ofMariaDB,youcanbeassuredthatyour
databaseswillbeverysecurebydefault.Mostotherdatabasesystemsdon’thave
encryptionbydefault.


MariaDB:TheDifferencesandExpectations
RegardingmyhopesandexpectationsfortheMariaDBdatabasesystem,I’mworkingat
thefoundationtoensurethatwegetmorecompaniesactivelyinvolvedinthedevelopment
ofMariaDB.That’ssomethingwelackedduringthehistoryofMySQL.Wewantto
developsomethingthatwillsatisfyeveryone—notonlynow,butforthefuture.Todo
that,weneedmoreorganizationsinvolved.We’rehappytoseeGoogleinvolvedinthe
MariaDBFoundation.I’dliketosee10or15companiesassignificantasGoogle
involved.That’ssomethingthey’vemanagedtodoatFOSS,theFreeandOpenSource
SoftwareFoundation.Theyhaveseveralcompaniesthatassistindevelopment.That’s
theirstrength.Theirweaknessisthattheydon’thaveonecompanycoordinatingthe
developmentofsoftware.MyhopeisthattheMariaDBFoundationwillactasa
coordinatorfortheeffort,butwithmanycompanieshelping.Thatwouldbenefiteveryone.
ItisthiscollaborativeeffortthatIdon’texpectfromOracleregardingMySQL.That’sthe
differenceandadvantageofMariaDB.WithOracle,there’snocertaintyinthefutureof
theopensourcecodeofMySQL.WithMariaDB,bydesignitwillalwaysbeopensource
andeverythingtheydowillbeopensource.Thefoundationismotivatedandtrulywantto
bemorecloselyalignedwithopensourcestandards.
TheMariaDBFoundationwascreatedtobeasanctuary.Ifsomethinggoeswronginthe
MariaDBCorporation,theFoundationcanguaranteethattheMariaDBsoftwarewill

remainopen—always.That’sitsmainrole.Theotherroleistoensurethatcompanies
thatwanttoparticipateindevelopingMariaDBsoftwarecandosoonequaltermsas
anyoneelsebecausethefoundationisthere.Soifsomeonecreatesandpresentsapatchfor
MariaDBsoftware,theycansubmitittobeincludedinthenextreleaseofMariaDB.With
manyotheropensourceprojects,it’sdifficulttogetapatchincludedinthesoftware.You
havetostruggleandlearnhowtoconformtotheircodingstyle.Andit’sevenhardertoget
thepatchaccepted.InthecaseofMySQLwithOracle,itcouldbeblockedbyOracle.The
situationisinherentlydifferentwithMariaDB.
Forexample,ifPercona,acompetitorofMariaDBCorporation,wantstoaddapatchto
MariaDBsoftwarethatwillhelptheirbackgroundprogramXtraBackuptorunbetter,but
themanagementofMariaDBCorporationdoesn’tlikethatitwouldbehelpingtheir
competitor,itdoesn’tmatter.MariaDBCorporationhasnosayinwhichpatchesare
adopted.IftheFoundationacceptsthepatch,it’saddedtothesoftware.TheFoundation
reviewpatchesontheirtechnicalmeritsonly,notbasedonanycommercialagenda.
Theopensourceprojectsthatsurvivedarethosethatwerecreatedforpracticalreasons.
MySQLwasn’tinthebeginningthebestdatabasesolution.Peoplecomplainedthatit
didn’thavemanyfeaturesatthattime.However,itwasalwayspractical.Itsolved
problemsandmettheneedsofdevelopersandothers.Anditdidsobetterthanother
solutionsthatweresupposedlybetterchoices.Wedidthatbyactivelylisteningtopeople
andwithawillingnesstomakechangestosolveproblems.OurgoalwithMariaDBisto
getbacktothoserootsandbemoreinteractivewithcustomersandusers.Bythismethod,
wecancreatesomethingthatmightnotbeperfectforeveryone,butprettygood.


TheFutureofMySQLandMariaDB
Asforthefuture,ifyouwantMariaDBtobepartofyourprofessionallife,Icanassure
youthatwewilldoeverythingpossibletosupportanddevelopthesoftware.Wehave
manybrilliantpeoplewhowillhelptoensureMariaDBhasalongfuture.
Inthenearterm,IthinkthatMariaDBversion10.1willplayalargeroleinsecuringthe
futureofMariaDB.ItoffersfullintegrationwithGaleracluster—anadd-onforMariaDB

forrunningmultipledatabaseserversforbetterperformance—becauseofthenew
encryptionfeatures.That’simportant.Inrecentmonths,allothertechnologieshavebeen
overshadowedwithsecurityconcernsbecausethesystemsofsomegovernmentsand
majorcompanieshavebeenhacked.Havinggoodencryptioncouldhavestoppedmostof
thoseattacksfromachievinganything.Theseimprovementswillchangetheperception
thatopensourcedatabasesarenotsecureenough.Manycommercialdatabasemakers
havesaidthatMySQLandMariaDBarenotsecure,andtheyhavebeenabletoconvince
somebusinessestochooseacommercialsolutioninsteadasaresult.WithMariaDB10.1,
though,wecanproveeasilythattheirargumentisnottrue.Sothat’sgood.Ifyou’ve
chosentouseMariaDB,youcanmakethispointwhenyou’reaskedaboutthedifference
betweenMySQLandMariaDB,andyoucanfeelgoodaboutyourchoiceoverthelong
termforthissamereason.
Lookingatthefuture,manycompaniesareleeryaboutusingcommercialdatabase
softwarebecausetheydon’tknowforsureifthecompiledcodecontainsbackdoorsfor
accessingthedataorifthereissomespecialwayinwhichthesoftwareisusing
encryptionthatcouldallowhackerstogetattheirdatabases.Ontheotherhand,countries
likeRussiaandChinaquestionwhetheropensourcedatabasesaresecure.Theonlyway
wecanassurethemofthatistoprovideaccesstothesourcecode,andthatmeansthey
mustuseopensourcesoftware.SoIdohopeandexpectthatinthefuturewewillsee
MySQLandMariaDBgrowingrapidlyinthesecountriesandsimilarorganizations,
becausewecanaddresstheirconcernswhencommercialsolutionscannot.Ironically,a
moretransparentsoftwaresystemispreferredbyalesstransparentgovernment.It’sbetter
notonlyforlesstransparentorganizations,butalsoforthosethatwanttokeeptheir
databasesmoresecure.Thisappliestoanorganizationthatwantstokeeptheirdataprivate
anddoesn’twantsomeoneelsesuchasahacker,oracompetitor,agovernmenttohave
accesstotheirdata.


YourFutureinLearningMySQLandMariaDB
BothMySQLandMariaDBfollowtheSQLconventionfordatabaselanguages,which

wascreatedabout30yearsago.ThenicethingaboutSQListhatithasn’tchangedmuch
inthelast30years.Mostly,onecandomorewithit.SoifyoulearnoneSQLsystemwell,
youcaneasilymakeatransitiontoanother.Thebasicconceptsthatyou’llacquirein
learninganSQLsystemlikeMySQLorMariaDB,willbeusefulforyourentirecareeras
adatabasedeveloperoradministrator.There’snothingtoindicatethatMySQLor
MariaDBwillgoawayforthenext50years.Alloftheconceptsforthepast20yearsof
MySQLarethesameastheyaretodayandwillprobablybethesameforthenextseveral
decades.Therearejustsomenewfeaturesandtoolstobeabletodoextratasks.Butthe
skillsyoualwaysneedarebasiconesandthey’recontainedinthisbook.Theseskillsare
onesthatwillalwaysbeofbenefittoyou.


AdviceonLearningMySQLandMariaDB
Youshouldn’tjustreadthisbook.YoushouldinstallMySQLorMariaDB,tryexecuting
theexamplesgiven,andcompletetheexercisesattheendofeachchapter.Youshouldalso
trytodosomethingusefulwiththesoftwareandtheSQLstatementsandfunctions
describedineachchapter.Youshouldusethetoolsorutilitiespresented.Ifyoudon’tget
practicalexperience,anybooklikethisonewillbeuselesstoyou.Ifyou’renotsurewhat
youcandotogetpracticalexperience,perhapsyoucouldtrytobuildawebsiteusing
MySQLorMariaDB.Trytosolvesomedata-relatedproblemwithoneofthesedatabase
systems.Begintomakeitpartofyourlife.Thenwhatyou’relearningmayhelpyou
immediatelyinsomeway.Bythismethod,youwillbecomemoreexcitedbywhatyou’re
learning.Youwillbetterlearnthebasicsbyusingthesoftwarefromalmostthebeginning.
Anotherwaytolearnmore,aswellasmakeyourselfknowninthecommunityandto
developabusinessnetworkthatcouldleadtomoreworkandbetterjobs,isby
participatingintheforumsandmailinglistsandIRCchannelsforMySQLandMariaDB.
Byusingwhatyou’relearningtohelpothers,you’llnotonlybecomepopular,butyou’ll
learnmoreintheprocessofhavingtoexplaintheconceptsyou’lllearninthisbook.
—MontyWidenius
Málaga,Spain,January2015




Preface
MySQListhemostpopularopensourcedatabasesystemavailable.It’sparticularlyuseful
forpublicwebsitesthatrequireafastandstabledatabase.Evenifyou’renotfamiliarwith
MySQL,you’veuseditmanytimes.YouuseitwhenyouuseGoogle,Amazon,Facebook,
Wikipedia,andmanyotherpopularwebsites.It’sthekeeperofthedatabehindhuge
websiteswiththousandsofpagesofdata,andsmallsiteswithonlyafewpages.It’salso
usedinmanynon-web-basedapplications.It’sfast,stable,andsmallwhenneeded.
ThesoftwarewasstartedbyMichael“Monty”WideniusandDavidAxmarkin1995and
islicensedundertheGNUGeneralPublicLicense.Intime,theyfoundedtheSwedish
companyMySQLAb(theAbstandsforaktiebolag,orstockcompany),whichyearslater
becameMySQL,Inc.,incorporatedintheUnitedStates.InJanuary2008,thecompany
wasacquiredbySunMicrosystems,whichseemedpromisingforthefutureofthe
software.ButinApril2009Oracle—amajorcompetitorofMySQLthatoffersclosed
sourcedatabasesoftware—acquiredSun.Manyworriedatthetimethatthisacquisition
wouldeventuallyendMySQLsoftwareasafree,opensourcealternativeonwhichmuch
oftheWebandmanysitesthathavechangedtheworldwerebuilt.Fiveyearsafterthe
acquisition,thishasn’tprovedtobethecase.Manynewfeatureshavebeenaddedto
MySQLandthenumberofMySQLdeveloperswithinandoutsideofOraclehasincreased.
DispleasedthatOracletookcontrolofMySQLsoftware,Montystartedanewcompany
(MontyProgramAb)thathasdevelopedaforkofthesoftwarecalledMariaDB.[1]
BecauseMySQLsoftwareislicensedwiththeGPL,itispossibletofreelyandlegallyuse
theMySQLsoftwareandaddtoit.Atthesametime,UlfSandberg,theformerSenior
VicePresidentofServicesatMySQL,Inc.,alongwithotherformeremployeesof
MySQL,leftSunandOracleandstartedSkySQLAb,providingsupport,consulting,
training,andotherservicesrelatedtoMySQLandMariaDBsoftware.AsofOctober
2013,MontyProgramhasmergedintoSkySQL,whichwasrenamedtoMariaDBAbin
October2014.Thesoftwarelicense,though,isnowheldbytheMariaDBFoundationso

thatitcannotbeboughtbyOracleoranyothercorporation.
Asforthecommunityrelatedtothesoftware,somehavebeenmigratingtoMariaDB,
preferringsoftwarenotassociatedwithalargeproprietarysoftwarecompany.Many
operatingsystemsdistributors,hardwaremakers,andsoftwarepackagersarenow
shippingtheirproductswithMariaDB,eithertogetherwithMySQLorwithoutit.Many
websitesthatusedMySQLsoftwarehaveswitchedtoMariaDB.It’seasytodo,andfor
mostsitesitrequiresnochangestoapplicationsthatuseMySQL—notasinglelineof
codeneedstobechangedtoswitchtoMariaDB.Ifyouwanttotakeadvantageofnew,
advancedfeaturesofMariaDB,itisnecessarytoaddorchangecodeinanapplicationthat
previouslyusedMySQL,butherestisthesame.
Althoughownership,companynames,andeventhenameofthesoftwarehaschanged,the
visionthatbeganalmost30yearsagoandthespiritthathasgrownstrongandvibrantin
thecommunityisthesameandcontinuesinMariaDB.
IfyouwanttolearnaboutMySQLandMariaDBsoftware,youcandoit.It’snotdifficult
tounderstandortouse.Thisbookhasbeenwrittentobeaprimerfornewcomersto


MySQLandMariaDB,togetyoustartedandhelpyoubeproductivequickly.It’salso
usefulforbeginnerswhohavelearnedonlypartsofMySQLandfeelthattheremaybe
keyaspectsusedcommonlythattheydon’tknow,thattheysomehowmissedorskipped
overwhenfirstlearningit.Atthebeginnerlevel,thereisnodifferencebetweenMySQL
andMariaDB.Sowhenyoulearnone,youlearntheother.Becauseofthis,thenames
MySQLandMariaDBareusedinterchangeably.


ReadingStrategy
Thechaptersofthisbookarewrittenandorderedbasedontheassumptionthatthereader
willreadtheminorder.Thisdoesnotassumethatsomechapterswon’tbeskipped;it’s
assumedthatmostwillskipPartI.Forinstance,inadditiontoskippingChapter1,the
introductorychapter,ifMySQLisalreadyinstalledonyourcomputer,youwouldprobably

skipChapter2,whichcoversinstallingMySQLandMariaDB.Ifyou’veneverused
MySQL,youprobablyshouldreadChapter3,TheBasicsandthemysqlClient.Afterthat,
allreadersshouldreadsequentiallythechapterscontainedinthePartsII,III,andIV.The
remainingchapters,containedinPartV,relatetoadministrationandnotallofthosemay
beofusetoyouearlyon.
Mostofthechaptersconcludewithasetofexercises.Theexercisesaredesignedtohelp
youthinkthroughwhatyou’vereadinthechapter.Workingthroughtheexerciseswill
helpreinforcewhatyoushouldhavelearnedfromtheexamplesinthechapter.
Incidentally,it’susefultotryenteringtheexamplesthroughoutthechaptersformore
practice.Theexercisesattheendofthechaptersdependonabuildingofknowledge,if
notfromonechaptertothenext,atleastfrompreviouschapters.


Text-BasedInterfaceandOperatingSystems
Manypeoplefeelthatgraphicaluserinterfaces(GUIs)arefasterwhenusingacomplex
softwareprogramorsystem.ThisaccountsforthepopularityofWindowsprograms.
However,whileitissaidthatapictureisworthathousandwords,whenyouwanttosay
onlyoneword,youdon’tneedtodrawapicture.Youdon’tneedtouseanelaborateGUI
tomakeaminutechangetoadatabase.
Inparticular,Idon’tlikeGUIsforcontrollingaserverorMySQL.Interfacestendto
changebetweenversionsoftheinterface.Command-lineutilitiesareverystableandtheir
basiccommandsdon’tusuallychange.Ifyouknowhowtoconfigureaserveratthe
commandline,itmatterslittlewhatkindofserveryou’reenteringcommandson.Any
examplesinthisbookthatareexecutedwithinMySQLareuniversal.Examplesshownat
thecommandlineareforUnix-likeoperatingsystems(e.g.,Linux).Ileaveittoreadersto
makethenecessaryadjustmentsfortheirparticularoperatingsystems(i.e.,howtogetto
thecommandprompt).


ConventionsUsedinThisBook

Thefollowingtypographicalconventionsareusedinthisbook:
Italic
Indicatesnewterms,URLs,emailaddresses,filenames,andfileextensions.
Constantwidth

Usedforprogramlistings,aswellaswithinparagraphstorefertoprogramelements
suchasvariableorfunctionnames,databases,datatypes,environmentvariables,
statements,andkeywords.
Constantwidthbold

Showscommandsorothertextthatshouldbetypedliterallybytheuser.
Constantwidthitalic

Showstextthatshouldbereplacedwithuser-suppliedvaluesorbyvaluesdetermined
bycontext.
TIP
Thisiconsignifiesatip,suggestion,orgeneralnote.
CAUTION
Thisiconindicatesawarningorcaution.


UsingCodeExamples
Allofthescriptsandprogramsshowninthebookareavailableforyoutoeasilycopyand
modifyforyourownuse.TheycanbefoundontheWebat
/>ThisbookisheretohelpyoulearnMySQLandMariaDBandtogetyourjobdonein
relationtothissoftware.Ingeneral,ifthisbookincludescodeexamples,youmayusethe
codeinyourprogramsanddocumentation.Youdonotneedtocontactusforpermission
unlessyou’rereproducingasignificantportionofthecode.Forexample,writinga
programthatusesseveralchunksofcodefromthisbookdoesnotrequirepermission.
SellingordistributingaCD-ROMofexamplesfromO’Reillybooksdoesrequire

permission.Answeringaquestionbycitingthisbookandquotingexamplecodedoesnot
requirepermission.Incorporatingasignificantamountofexamplecodefromthisbook
intoyourproduct’sdocumentationdoesrequirepermission.
Weappreciate,butdonotrequire,attribution.Anattributionusuallyincludesthetitle,
author,publisher,andISBN.Forexample:“LearningMySQLandMariaDBbyRussell
J.T.Dyer(O’Reilly).Copyright2015RussellJ.T.Dyer,978-1-449-36290-4.”
Ifyoufeelyouruseofcodeexamplesfallsoutsidefairuseorthepermissiongivenabove,
youmaycontactusattorequestspecialpermission.


Safari®BooksOnline
NOTE
SafariBooksOnlineisanon-demanddigitallibrarythatdeliversexpertcontentinbothbookandvideoformfromthe
world’sleadingauthorsintechnologyandbusiness.

Technologyprofessionals,softwaredevelopers,webdesigners,andbusinessandcreative
professionalsuseSafariBooksOnlineastheirprimaryresourceforresearch,problem
solving,learning,andcertificationtraining.
SafariBooksOnlineoffersarangeofplansandpricingforenterprise,government,
education,andindividuals.
Membershaveaccesstothousandsofbooks,trainingvideos,andprepublication
manuscriptsinonefullysearchabledatabasefrompublisherslikeO’ReillyMedia,
PrenticeHallProfessional,Addison-WesleyProfessional,MicrosoftPress,Sams,Que,
PeachpitPress,FocalPress,CiscoPress,JohnWiley&Sons,Syngress,Morgan
Kaufmann,IBMRedbooks,Packt,AdobePress,FTPress,Apress,Manning,NewRiders,
McGraw-Hill,Jones&Bartlett,CourseTechnology,andhundredsmore.Formore
informationaboutSafariBooksOnline,pleasevisitusonline.


HowtoContactUs

Pleaseaddresscommentsandquestionsconcerningthisbooktothepublisher:
O’ReillyMedia,Inc.
1005GravensteinHighwayNorth
Sebastopol,CA95472
800-998-9938(intheUnitedStatesorCanada)
707-829-0515(internationalorlocal)
707-829-0104(fax)

Wehaveawebpageforthisbook,wherewelisterrata,examples,andanyadditional
information.Youcanaccessthispageat />Tocommentorasktechnicalquestionsaboutthisbook,sendemailto

Formoreinformationaboutourbooks,courses,conferences,andnews,seeourwebsiteat
.
FindusonFacebook: />FollowusonTwitter: />WatchusonYouTube: />

×