Tải bản đầy đủ

OReilly MySQL in a nutshell 2nd edition apr 2008 ISBN 0596514336

MySQLinaNutshell
byRussellDyer
Publisher:O'Reilly
PubDate:April15,2008
PrintISBN-13:978-0-596-51433-4
Pages:564
TableofContents|Index

Overview
WhenyouneedtofindtherightSQLkeywordorMySQLclient
command-lineoptionrightaway,turntothisconvenient
reference,knownforthesamespeedandflexibilityasthe
systemitcoverssothoroughly.MySQLispackedwithsomany
capabilitiesthattheoddsofrememberingaparticularfunction
orstatementattherightmomentareprettyslim.WithMySQL
inaNutshell,yougetthedetailsyouneed,dayinanddayout,
inoneconciseandextremelywellorganizedbook.Thenew
editioncontainsallthecommandsandprogramming
informationforversion5.1,includingnewfeaturesand
languageinterfaces.It'sidealforanyoneusingMySQL,from
noviceswhoneedtogetuptospeedtoadvanceduserswho

wantahandyreference.LikeallO'ReillyNutshellreferences,it's
easytouseandhighlyauthoritative,writtenbytheeditorofthe
MySQLKnowledgeBaseatMySQLAB,thecreatorandownerof
MySQL.Inside,you'llfind:
AthoroughreferencetoMySQLstatements,functions,and
administrativeutilities
Severaltutorialchapterstohelpnewcomersgetstarted
ProgramminglanguageAPIsforPHP,Perl,andC
BrieftutorialsatthebeginningofeachAPIchaptertohelp
anyone,regardlessofexperiencelevel,understandand


masterunfamiliarterritory
Newchaptersonreplication,triggers,andstored
procedures
PlentyofnewexamplesofhowMySQLisusedinpractice
Usefultipstohelpyougetthroughthemostdifficult
subjects
WhetheryouemployMySQLinamission-critical,heavy-use
environmentorforapplicationsthataremoremodest,thisbook
putsawealthofeasy-to-findinformationatyourfingertips,
savingyouhundredsofhoursoftrialanderrorandtedious
onlinesearching.Ifyou'rereadytotakeadvantageof
everythingMySQLhastooffer,MySQLinaNutshellhas
preciselywhatittakes.


MySQLinaNutshell
byRussellDyer
Publisher:O'Reilly
PubDate:April15,2008
PrintISBN-13:978-0-596-51433-4
Pages:564
TableofContents|Index

Copyright
Dedication
Preface
Part1:IntroductionandTutorials
Chapter1.IntroductiontoMySQL
Section1.1.TheValueofMySQL
Section1.2.TheMySQLPackage
Section1.3.Licensing
Section1.4.MailingLists
Section1.5.BooksandOtherPublications
Chapter2.InstallingMySQL
Section2.1.ChoosingaDistribution
Section2.2.UnixSourceDistributions
Section2.3.UnixBinaryDistributions
Section2.4.LinuxRPMDistributions
Section2.5.MacintoshOSXDistributions
Section2.6.NovellNetWareDistributions
Section2.7.WindowsDistributions
Section2.8.Postinstallation
Chapter3.MySQLBasics
Section3.1.ThemysqlClient
Section3.2.CreatingaDatabaseandTables
Section3.3.ShowMe


Section3.4.InsertingData
Section3.5.SelectingData
Section3.6.Ordering,Limiting,andGrouping
Section3.7.AnalyzingandManipulatingData
Section3.8.ChangingData
Section3.9.DeletingData
Section3.10.SearchingData
Section3.11.ImportingDatainBulk
Section3.12.Command-LineInterface
Section3.13.Conclusion
Part2:SQLStatementsandFunctions
Chapter4.SecurityandUserStatementsandFunctions
Section4.1.StatementsandFunctions
Section4.2.SQLStatementsinAlphabeticalOrder
Section4.3.FunctionsinAlphabeticalOrder
Chapter5.DatabaseandTableSchemaStatements
Section5.1.StatementsandClausesinAlphabetical
Order
Chapter6.DataManipulationStatementsandFunctions
Section6.1.StatementsandFunctionsGroupedby
Characteristics
Section6.2.StatementsandClausesinAlphabetical
Order
Section6.3.FunctionsinAlphabeticalOrder
Chapter7.TableandServerAdministrationStatementsand
Functions
Section7.1.StatementsandClausesinAlphabetical
Order
Section7.2.FunctionsinAlphabeticalOrder
Chapter8.ReplicationStatementsandFunctions
Section8.1.MeritsofReplication
Section8.2.ReplicationProcess
Section8.3.TheReplicationUserAccount


Section8.4.ConfiguringtheServers
Section8.5.CopyingDatabasesandStartingReplication
Section8.6.StartingReplication
Section8.7.BackupswithReplication
Section8.8.SQLStatementsandFunctionsin
AlphabeticalOrder
Section8.9.ReplicationStates
Chapter9.StoredRoutinesStatements
Section9.1.StatementsinAlphabeticalOrder
Chapter10.AggregateClauses,AggregateFunctions,and
Subqueries
Section10.1.AggregateFunctionsinAlphabeticalOrder
Section10.2.Subqueries
Chapter11.StringFunctions
Section11.1.StringFunctionsGroupedbyType
Section11.2.StringFunctionsinAlphabeticalOrder
Chapter12.DateandTimeFunctions
Section12.1.DateandTimeFunctionsGroupedbyType
Section12.2.DateandTimeFunctionsinAlphabetical
Order
Chapter13.MathematicalFunctions
Section13.1.FunctionsinAlphabeticalOrder
Chapter14.FlowControlFunctions
Section14.1.FunctionsinAlphabeticalOrder
Part3:MySQLServerandClientTools
Chapter15.MySQLServerandClient
Section15.1.mysqlClient
Section15.2.mysqldServer
Section15.3.mysqld_multi
Section15.4.mysqld_safe
Chapter16.Command-LineUtilities
C


comp_err
M
make_binary_distribution
msql2mysql
my_print_defaults
myisam_ftdump
myisamchk
myisamlog
myisampack
mysql_convert_table_format
mysql_find_rows
mysql_fix_extensions
mysql_fix_privilege_tables
mysql_setpermission
mysql_tableinfo
mysql_upgrade
mysql_waitpid
mysql_zap
mysqlaccess
mysqladmin
mysqlbinlog
mysqlbug
mysqlcheck
mysqldump
mysqldumpslow
mysqlhotcopy
mysqlimport
mysqlshow
mysqlslap
P
perror
R


replace
resolve_stack_dump
resolveip
Part4:APIsandConnectors
Chapter17.CAPI
Section17.1.UsingCwithMySQL
Section17.2.FunctionsinAlphabeticalOrder
Section17.3.CAPIDatatypes
Chapter18.PerlAPI
Section18.1.UsingPerlDBIwithMySQL
Section18.2.PerlDBIReference
Section18.3.AttributesforHandles
Chapter19.PHPAPI
Section19.1.UsingPHPwithMySQL
Section19.2.PHPMySQLFunctionsinAlphabeticalOrder
Part5:Appendixes
AppendixA.DataTypes
SectionA.1.NumericDataTypes
SectionA.2.DateandTimeDataTypes
SectionA.3.StringDataTypes
AppendixB.Operators
SectionB.1.ArithmeticOperators
SectionB.2.RelationalOperators
SectionB.3.LogicalOperators
SectionB.4.BitwiseOperators
SectionB.5.RegularExpressions
AppendixC.ServerandEnvironmentVariables
Colophon
Index


Copyright
Copyright©2008,RussellJ.T.Dyer.Allrightsreserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles(http://safari.oreilly.com).Formoreinformation,
contactourcorporate/institutionalsalesdepartment:(800)
998-9938orcorporate@oreilly.com.
Editor:AndyOram
ProductionEditor:SarahSchneider
Editor:SarahSchneider
NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
MySQLinaNutshell,theimageofapiedkingfisher,andrelated
tradedressaretrademarksofO'ReillyMedia,Inc.
Manyofthedesignationsusesbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.


TomyfriendRichardStringer,forencouragingmein
literature,liberalism,andwriting,andforhelpingmeto
becomethepersonIwasmeanttobe.


Preface
MySQListhemostpopularopensourcedatabasesystem
available.Althoughit'sfree,it'sstillverydependableandfast,
andisbeingemployedincreasinglyinareasthatusedtobethe
provinceofOracleorMSSQLServer.Thankstoavarietyof
utilitiespackagedwithMySQL,administrationisfairlyeffortless.
Withitsseveralapplicationprogramminginterfaces(APIs),it's
easytodevelopyourownsoftwaretointerfacewithMySQL.
ThisbookprovidesaquickreferencetoMySQLstatementsand
functions,theadministrativeutilities,andthemostpopular
APIs.Thefirstfewchaptersaredesignedtohelpyoutoget
startedwithMySQL.EachchapteronanAPIalsostartswitha
tutorial.
Whenthisbookwaswritten,version5.0ofMySQLwas
generallyavailable,andearlyreleasesofthedevelopment
versionsof5.1and6.0wereavailablebutnotyetstable.Asa
result,youwillfindmostlyfeaturesfromversion5.0.xinthis
book.Featuresthatappearonlyinnewerversionsarenotedas
such.

P.1.ThePurposeofThisBook
Thepurposeofthisbookistoprovideaquickreferenceto:
MySQLstatementsandfunctions
Command-lineoptionsandconfigurationinformationforthe
MySQLserverandutilities
ThemostpopularAPIsusedtoaccessMySQLdatabases
Severalchaptersstartwithtutorials,butthecentralpurposeof
thebookistofillinthegapsforpeoplewhoarealready
comfortablewithrelationaldatabases.
TheformatthatI'vefollowedforadescriptionofeach


statementorfunctionistomovefromcurtmemory-joggersto
moreleisurelyexplanations.Ifyouknowthestatementor
functionthatyou'relookingup,butcan'tquiterememberthe
syntax,you'llfindthatfirst.Ifyouneedabitmoreinformation
tojogyourmemoryortoclarifythepossibilitiesavailable,you
canfindthisinthefirstsentenceorsooftheexplanation.If
yourequiremoreclarification,youcancontinuewiththe
slower-pacedmaterialthatwillfollowastatementorfunction.
Examplesofusageareprovidedforalmostallstatementsand
functions.
Insummary,thegoalistobebriefbutfairlycomplete,andto
increasethelevelofdetailasyoureadon.

P.2.HowThisBookIsOrganized
Thisbookisbrokenupinto14chaptersand3appendixes,as
follows.

P.2.1.PartI,IntroductionandTutorials
Chapter1,explainsthemajorcomponentsofMySQLanduseful
guidelinesforotherinformationonMySQL.
Chapter2,describeshowtogetMySQLrunningoncommon
operatingsystemssupportedbyMySQLAB.Itisnecessaryto
readthischapteronlyifyoursystemdoesnotalreadyhave
MySQLinstalled.
Chapter3,introducesSQL(StructuredQueryLanguage)and
useofthemysqlcommand-lineinterface.It'snotareplacement
forlearningSQLandrelationaldatabasedesign,butitcanbe
usefultoorientyoutoMySQL.

P.2.2.PartII,SQLStatementsandFunctions
Chapter4,coversSQLstatementsandfunctionsrelatedtothe
managementofuseraccountsandsecurity.
Chapter5,lists,explains,andprovidesexamplesofSQL


statementsandfunctionsrelatedtothecreating,altering,and
droppingofdatabases,tables,indexes,andviews.
Chapter6,coversanySQLstatementsandfunctionsthat
involvethemanipulationofdata—inserting,updating,replacing,
ordeleting.
Chapter7,includesdetailsandexamplesrelatedtoSQL
statementsandfunctionsthatmightbeusedinthe
administrationofdatabases,tables,ortheserver.
Chapter8,includesSQLstatementsthatstrictlyrelateto
replication.Thischapteralsoincludesatutorialandan
explanationofthereplicationprocess.Italsoexplainsthe
replicationstatestohelpinsolvingproblems.
Chapter9,coversstatementsspecificallyrelatedtoevents,
storedprocedures,triggers,anduser-definedfunctions.
Chapter10,combinesaggregateclauses(i.e.,GROUPBY)and
functionsthatbasicallyareonlyusedwithanaggregateclause.
Italsoincludesatutorialonsubqueriesastheycanbeusedto
aggregatedata.
Chapter11,coversanyfunctionsthatarerelatedtothe
manipulationofstringsofdata.
Chapter12,coversdateandtimerelatedfunctions.
Chapter13,explainsandgivesexamplesofstrictly
mathematicalrelatedfunctions.
Chapter14,coversflowcontrolfunctionssuchasCASEandIF.

P.2.3.PartIII,MySQLServerandClientTools
Chapter15,coversthemysqlddaemonandthemysqlclient
andtheiroptions.Italsoexplainsscriptsusedtostartthe
server(e.g.,mysqld_safe).
Chapter16,describestheutilitiesthatcanbeusedto


administertheMySQLserveranddata.Italsoincludesutilities
suchasmysqldumpusedfordatabackups.

P.2.4.PartIV,MySQLAPI
Chapter17,coversthefunctionsprovidedbyMySQL'sbasicC
library.
Chapter18,presentsthePerlDBImodule,usedtoaccess
MySQLdatabasesfromtheprogramminglanguagePerl.
Chapter19,presentsthePHPfunctionsusedtoqueryand
manipulateMySQLdatabases.

P.2.5.Appendixes
AppendixAlistsallthedatatypessupportedbyMySQL.
AppendixBlistsallMySQLoperators,suchasarithmeticsigns
andtheLIKEandISNULLcomparisonoperators.
AppendixCliststheoperatingsystem'senvironmentvariables
consultedbytheMySQLserver,client,andotherutilities.

P.3.ConventionsUsedinThisBook
Thefollowingtypographicalconventionsareusedinthisbook:
Plaintext
Indicatesmenutitles,menuoptions,menubuttons,and
keyboardaccelerators(suchasAltandCtrl).

Italic
Indicatesnewterms,URLs,emailaddresses,usernames,
hostnames,filenames,fileextensions,pathnames,and
directories.


Constantwidth
Indicateselementsofcode,configurationoptions,variables,
functions,modules,databases,tables,columns,commandlineutilities,thecontentsoffiles,ortheoutputfrom
commands.

Constantwidthbold
Showscommandsorothertextthatshouldbetyped
literallybytheuser.

Constantwidthitalic
Showstextthatshouldbereplacedwithuser-supplied
values.

P.4.UsingCodeExamples
Thisbookisheretohelpyougetyourjobdone.Ingeneral,you
mayusethecodeinthisbookinyourprogramsand
documentation.Youdonotneedtocontactusforpermission
unlessyou'rereproducingasignificantportionofthecode.For
example,writingaprogramthatusesseveralchunksofcode
fromthisbookdoesnotrequirepermission.Sellingor
distributingaCD-ROMofexamplesfromO'Reillybooksdoes
requirepermission.Answeringaquestionbycitingthisbook
andquotingexamplecodedoesnotrequirepermission.
Incorporatingasignificantamountofexamplecodefromthis
bookintoyourproduct'sdocumentationdoesrequire
permission.
Weappreciate,butdonotrequire,attribution.Anattribution
usuallyincludesthetitle,author,publisher,andISBN.For
example:"MySQLinaNutshell,SecondEdition,byRussellJ.T.
Dyer.Copyright2008RussellJ.T.Dyer,978-0-596-51433-4."


Ifyoufeelyouruseofcodeexamplesfallsoutsidefairuseor
thepermissiongivenhere,feelfreetocontactusat
permissions@oreilly.com.

P.5.RequestforComments
Pleaseaddresscommentsandquestionsconcerningthisbookto
thepublisher:
O'ReillyMedia,Inc.
1005GravensteinHighwayNorth
Sebastopol,CA95472
800-998-9938(intheUnitedStatesorCanada)
707-829-0515(internationalorlocal)
707-829-0104(fax)
Theexamplesinthisbookareprofessionallywrittenandhave
beentested,butthatdoesnotmeanthattheyareguaranteed
tobebug-freeortoworkcorrectlywithyourversionandyour
platform'simplementationofMySQL.Ifyouhaveproblems,find
bugs,orhavesuggestionsforfutureeditions,pleaseemail
themto:
bookquestions@oreilly.com
There'sawebpageforthisbookthatlistserrata,examples,
andanyadditionalinformation.Youcanaccessthispageat:
http://www.oreilly.com/catalog/9780596514334
Formoreinformationaboutbooks,conferences,Resource
Centers,andtheO'ReillyNetwork,seetheO'Reillywebsiteat:
http://www.oreilly.com
Formoreinformationabouttheauthor,gotohiswebsiteat:
http://russell.dyerhouse.com


P.6.Safari®Enabled
NOTE
WhenyouseeaSafari®Enabledicononthecoverof
yourfavoritetechnologybook,thatmeansthebookis
availableonlinethroughtheO'ReillyNetworkSafari
Bookshelf.
Safarioffersasolutionthat'sbetterthane-books.It'savirtual
librarythatletsyoueasilysearchthousandsoftoptechbooks,
cutandpastecodesamples,downloadchapters,andfindquick
answerswhenyouneedthemostaccurate,currentinformation.
Tryitforfreeathttp://safari.oreilly.com.

P.7.Acknowledgments
ThankstoAndyOram,myeditor,forhisguidanceandediting,
andforhelpingmetobethepersonfortunateenoughtowrite
thisbookyetagain.Iverymuchwanttothankhimandhis
family(hiswife,JudyLebow,andtheirchildren,Soniaand
Sam)fortakingmeintotheirhomeforsixweeksaftermy
hometownofNewOrleanswasdevastatedbyHurricane
Katrina.Ishallalwaysappreciatetheirgenerosity.
ThanksalsotoRickRezinas,JudithMyerson,BogdanKecman,
andothersforreviewingthemanuscriptfortechnicalaccuracy.
Theirassistancewasgreatlyappreciated.ThanksalsotoIsabel
Kunkel(theassistanteditorforthebook)forherroleinchasing
medowntogetchapterswrittenandturnedin.Specialthanks
toKathrynBarrett(publicistforO'Reilly)forhermoralsupport
andadviceoverthepastfewyears.
ForthelastthreeyearsIhavebeenworkingatMySQLInc.as
theeditorofitsKnowledgeBase.InthattimeI'velearneda
greatdealmoreaboutMySQLsoftware,andmademany


friends.It'safabulouscompanyandacaringcommunity.When
thehurricanechasedmeoutofNewOrleansinthesummerof
2005,manyofthepeopleatMySQLassistedmeinmyrecovery
withfundstheypersonallycontributed,aswellasemotionaland
moralsupport.Theirassistancehelpedmeestablishanew
homeformyselfanddealwiththeproblemsIencounteredafter
thelossofmyoldhomeandcommunity.And,ofcourse,many
ofthemhelpedwithinformationandadvicerelatedtothe
writingofthisbook.FromMySQL,I'despeciallyliketothankUlf
Sandberg(seniorvicepresident)foralwaysbeingsupportiveof
me,andRustyOsborne(myfriendof10yearsandcoworkerin
theKB)forherhelpandforcontinuingtolistentomethrough
itall.


Part1:IntroductionandTutorials
Thispartofthebookpresentsinformationthatisusefulto
readerswhoneedabasicintroductiontoMySQL.Thispart
willprobablynotbesufficientforsomeonewhoistotally
newtodatabaseprogrammingandadministration;ahostof
otherintroductorybooksexistforthatreader.However,this
partcanprovidethenecessarybackgroundtosomeonewho
hassomeknowledgeofotherdatabasesandwantstomove
toMySQL,whohasusedaMySQLdatabaseonahosting
serviceandwantstocreateastandaloneserver,orwhohas
othergapsinintroductoryknowledge.Installation,basic
configuration,andessentialSQLareexplainedinthispart
ofthebook.


Chapter1.IntroductiontoMySQL
MySQLisanopensource,multithreaded,relationaldatabase
managementsystemcreatedbyMichael"Monty"Wideniusin
1995.In2000,MySQLwasreleasedunderadual-licensemodel
thatpermittedthepublictouseitforfreeundertheGNU
GeneralPublicLicense(GPL);thiscauseditspopularitytosoar.
ThecompanythatownsanddevelopsMySQLisMySQLAB(the
ABstandsforaktiebolag,theSwedishtermforstockcompany),
whichisnowasubsidiaryofSunMicrosystems.Currently,
MySQLABestimatesthattherearemorethan6million
installationsofMySQLworldwide,andreportsanaverageof
50,000downloadsadayofMySQLinstallationsoftwarefromits
siteandfrommirrorsites.ThesuccessofMySQLasaleading
databaseisduenotonlytoitsprice—afterall,othercost-free
andopensourcedatabasesareavailable—butalsoitsreliability,
performance,andfeatures.

1.1.TheValueofMySQL
ManyfeaturescontributetoMySQL'sstandingasasuperb
databasesystem.Itsspeedisoneofitsmostprominent
features.InacomparisonbyeWEEKofseveraldatabases—
includingMySQL,Oracle,MSSQL,IBMDB2,andSybaseASE—
MySQLandOracletiedforbestperformanceandforgreatest
scalability(seehttp://www.mysql.com/it-resources/benchmarks
formoredetails).MySQLisremarkablyscalable,andisableto
handletensofthousandsoftablesandbillionsofrowsofdata.
Plus,itmanagessmallamountsofdataquicklyandsmoothly.
Thestorageengine,whichmanagesqueriesandinterfaces
betweenauser'sSQLstatementsandthedatabase'sbackend
storage,isthecriticalsoftwareinanydatabasemanagement
system.MySQLoffersseveralstorageengineswithdifferent
advantages.Somearetransaction-safestorageenginesthat
allowforrollbackofdata.Additionally,MySQLhasa
tremendousnumberofbuilt-infunctionsthataredetailedin
severalchaptersofthisbook.MySQLisalsoverywellknownfor


rapidandstableimprovements.Eachnewreleasecomeswith
speedandstabilityupgrades,aswellasnewfeatures.


Part1:IntroductionandTutorials
Thispartofthebookpresentsinformationthatisusefulto
readerswhoneedabasicintroductiontoMySQL.Thispart
willprobablynotbesufficientforsomeonewhoistotally
newtodatabaseprogrammingandadministration;ahostof
otherintroductorybooksexistforthatreader.However,this
partcanprovidethenecessarybackgroundtosomeonewho
hassomeknowledgeofotherdatabasesandwantstomove
toMySQL,whohasusedaMySQLdatabaseonahosting
serviceandwantstocreateastandaloneserver,orwhohas
othergapsinintroductoryknowledge.Installation,basic
configuration,andessentialSQLareexplainedinthispart
ofthebook.


Chapter1.IntroductiontoMySQL
MySQLisanopensource,multithreaded,relationaldatabase
managementsystemcreatedbyMichael"Monty"Wideniusin
1995.In2000,MySQLwasreleasedunderadual-licensemodel
thatpermittedthepublictouseitforfreeundertheGNU
GeneralPublicLicense(GPL);thiscauseditspopularitytosoar.
ThecompanythatownsanddevelopsMySQLisMySQLAB(the
ABstandsforaktiebolag,theSwedishtermforstockcompany),
whichisnowasubsidiaryofSunMicrosystems.Currently,
MySQLABestimatesthattherearemorethan6million
installationsofMySQLworldwide,andreportsanaverageof
50,000downloadsadayofMySQLinstallationsoftwarefromits
siteandfrommirrorsites.ThesuccessofMySQLasaleading
databaseisduenotonlytoitsprice—afterall,othercost-free
andopensourcedatabasesareavailable—butalsoitsreliability,
performance,andfeatures.

1.1.TheValueofMySQL
ManyfeaturescontributetoMySQL'sstandingasasuperb
databasesystem.Itsspeedisoneofitsmostprominent
features.InacomparisonbyeWEEKofseveraldatabases—
includingMySQL,Oracle,MSSQL,IBMDB2,andSybaseASE—
MySQLandOracletiedforbestperformanceandforgreatest
scalability(seehttp://www.mysql.com/it-resources/benchmarks
formoredetails).MySQLisremarkablyscalable,andisableto
handletensofthousandsoftablesandbillionsofrowsofdata.
Plus,itmanagessmallamountsofdataquicklyandsmoothly.
Thestorageengine,whichmanagesqueriesandinterfaces
betweenauser'sSQLstatementsandthedatabase'sbackend
storage,isthecriticalsoftwareinanydatabasemanagement
system.MySQLoffersseveralstorageengineswithdifferent
advantages.Somearetransaction-safestorageenginesthat
allowforrollbackofdata.Additionally,MySQLhasa
tremendousnumberofbuilt-infunctionsthataredetailedin
severalchaptersofthisbook.MySQLisalsoverywellknownfor


rapidandstableimprovements.Eachnewreleasecomeswith
speedandstabilityupgrades,aswellasnewfeatures.


Part1:IntroductionandTutorials
Thispartofthebookpresentsinformationthatisusefulto
readerswhoneedabasicintroductiontoMySQL.Thispart
willprobablynotbesufficientforsomeonewhoistotally
newtodatabaseprogrammingandadministration;ahostof
otherintroductorybooksexistforthatreader.However,this
partcanprovidethenecessarybackgroundtosomeonewho
hassomeknowledgeofotherdatabasesandwantstomove
toMySQL,whohasusedaMySQLdatabaseonahosting
serviceandwantstocreateastandaloneserver,orwhohas
othergapsinintroductoryknowledge.Installation,basic
configuration,andessentialSQLareexplainedinthispart
ofthebook.


Chapter1.IntroductiontoMySQL
MySQLisanopensource,multithreaded,relationaldatabase
managementsystemcreatedbyMichael"Monty"Wideniusin
1995.In2000,MySQLwasreleasedunderadual-licensemodel
thatpermittedthepublictouseitforfreeundertheGNU
GeneralPublicLicense(GPL);thiscauseditspopularitytosoar.
ThecompanythatownsanddevelopsMySQLisMySQLAB(the
ABstandsforaktiebolag,theSwedishtermforstockcompany),
whichisnowasubsidiaryofSunMicrosystems.Currently,
MySQLABestimatesthattherearemorethan6million
installationsofMySQLworldwide,andreportsanaverageof
50,000downloadsadayofMySQLinstallationsoftwarefromits
siteandfrommirrorsites.ThesuccessofMySQLasaleading
databaseisduenotonlytoitsprice—afterall,othercost-free
andopensourcedatabasesareavailable—butalsoitsreliability,
performance,andfeatures.

1.1.TheValueofMySQL
ManyfeaturescontributetoMySQL'sstandingasasuperb
databasesystem.Itsspeedisoneofitsmostprominent
features.InacomparisonbyeWEEKofseveraldatabases—
includingMySQL,Oracle,MSSQL,IBMDB2,andSybaseASE—
MySQLandOracletiedforbestperformanceandforgreatest
scalability(seehttp://www.mysql.com/it-resources/benchmarks
formoredetails).MySQLisremarkablyscalable,andisableto
handletensofthousandsoftablesandbillionsofrowsofdata.
Plus,itmanagessmallamountsofdataquicklyandsmoothly.
Thestorageengine,whichmanagesqueriesandinterfaces
betweenauser'sSQLstatementsandthedatabase'sbackend
storage,isthecriticalsoftwareinanydatabasemanagement
system.MySQLoffersseveralstorageengineswithdifferent
advantages.Somearetransaction-safestorageenginesthat
allowforrollbackofdata.Additionally,MySQLhasa
tremendousnumberofbuilt-infunctionsthataredetailedin
severalchaptersofthisbook.MySQLisalsoverywellknownfor


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×

×