版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
主讲主讲:马永亮(马哥QQ群客服QQ:2813150558,InstallingAccessingcommand-lineGUITodescribeanassortmentofproductsandsystemsthathaveincludedanythingfromacollectionoffilestoacomplexstructuremadeupofuserinterfaces,datastorageandaccessmechanisms,andclient/serverAtitssimplest,adatabaseisacollectionofdatathatisusuallyrelatedinsomefashion.Yetadatabaseismorethansimplyacollectionofrelateddata.Thedatamustbeorganizedandclassifiedinastructuredformatthatisdescribedbymetadata,whichisdatathatdescribesthedatabeingstored.TheRelationalTheTheRelationalTheldataadeparturetherigidstructuresofthehierarchicalandApplicationsaccessingahierarchicaldatabaserelyonadefinedimplementationofthatdatabase,andthedatabasestructuremustbehard-codedintotheapplication’sprogramminglanguage.Ifthedatabasechanges,theapplicationmustchange.However,arelationaldatabaseisindependentoftheManagementManagementADBMSismadeupofacomprehensivesetofserverandclienttoolsthatsupportvariousadministrativeanddata-relatedtasksAttheveryleast,aDBMSmuststoredataandallowdatatoberetrievedandmodifiedinawaythatprotectsthedataagainstoperationsthatcouldcorruptorinsertinconsistenciesintothe Managing Maintaining Maintaining Managing Supporting Optimizing Providingback-upandrecovery Processingrequestsfordataretrievaland开数据库开数据库设代码设计:存储过程、存储函数、触发管连接管理及优数据库软件安装及升配置优WhatWhatisSQLis,aboveallelse,acomputerlanguageusedtomanageandinteractwithdatainarelationaldatabaseSQLworksinconjunctionwithaRDBMStodefinethestructureofthedatabase,storedatainthatdatabase,manipulatethedata,retrievethedata,controlaccesstothedata,andensuretheintegrityofthedataMySQLisbuiltwithCandC++.Thefunctionsthatsuchanapplicationperformsinordertosupportconnectivity,provideAPIs,enablenetworkaccess,orinteractwithclienttoolsarecarriedoutattheCandC++programminglevel.TheprimarypurposeofSQListoallowtheRDBMStointeractwiththedata.AABriefHistoryofAftertherelationalmodelwasintroducedtothedatabasedevelopmentcommunityintheearly1970s,IBMbeganresearchingwaystoimplementthatmodel.IBM’sresearch,referredtoastheSystem/Rproject,resultedinaprototypeofthefirstRDBMS.AspartoftheSystem/Rproject,IBMproducedthefirstincarnationofarelationaldatabaselanguage,whichwasknownStructuredEnglishQueryLanguageOverthenextfewyears,IBMupdatedtheprototypeandreleasedSEQUEL/2,whichwaslaterrenamedtoANSIANSIBythemid-1980s,relationaldatabasesandSQLhadbecomeanindustrystandardANSIreleasedthefirstpublishedSQLstandard(SQL-86)inANSIupdatedthestandardin1989(SQL-89)andagainin1992(SQL-92)Becauseofthesignificantexpansionofthestandard,SQL-92definedthreelevelsofconformance:Entry:Thislevelrepresentedthemostbasicstageofconformance,andwasprimarilyontheSQL-89standard,withonlyafewimprovements.Intermediate:Althoughthislevelrepresentedsignificantadvancementstotheproduct,itwasbelievedthatmostproductscouldachievecompliance.Full:ARDBMShadtobeincompletecompliancewiththeIn1999,ANSI,alongwiththeInternationalOrganizationforStandardization(ISO)publishedSQL:1999,thefirstcompleteupdatetotheSQLstandardsince1992SQL:1999standardtookadifferentapproachtoconformanceTobeinconformancetothenewstandard,aRDBMShadtobeincompliancewithCoreSQLMostRDBMSs,includingMySQL,conformtotheEntrylevelofSQL-92andachievsomeconformancetoCoreSQLinSQL:1999SQL:2003,introducedsomeadditionalfeaturescomparedSQL:1999,suchasExtensibleMarkupLanguage(XML)范约候选primary范约候选primary(主键foreignkey(外键检查性约unique惟一MySQLMySQL主讲:马永亮(马哥QQ群客服QQ:2813150558,事务,隔离,并发控制,用户和权监索引类型:查备份和恢复制功集Oracle:9i,10GSQLServerOracle:9i,10GSQLServerMySQLTheMySQLMySQLisarelationaldatabasemanagementsystem(RDBMS)thatrunsasTheMySQLMySQLisarelationaldatabasemanagementsystem(RDBMS)thatrunsasaserverprovidingmulti-useraccesstoanumberofMySQLisofficiallypronouncedɛl/("MyS-Q-L"),isoftenpronounced/maɪsiːkwəl/("MySequel").ItisnamedoriginaldeveloperMichaelWidenius'sdaughterTheMySQLdevelopmentprojecthasmadeitssourcecodeavailableunderthetermsoftheGNUGeneralPublicLicense,aswellasunderavarietyofproprietaryagreementsMySQLisownedandsponsoredbyasinglefor-profitfirm,theSwedishcompanyMySQLAB,nowownedbySunMicrosystems,asubsidiaryofOracleCorporationMont,Mont,TcX,Unireg,Unireg,MySQL96,MySQL,完完全多线查询缓Scalability(伸缩性EaseofPortabilityandStandardsComplianceMultiuserSupportWideApplicationC,C++,Java,Perl,PHP,Python,JDBC,ODBC,OpenTheTheMySQLTherootsofMySQLserverarefoundinadatabasesystemcalledUniregthatwasdevelopedbyMichael‘‘Monty’’WideniusforaSwedishcompanycalledTcXduringthe1980sTheinitialreleaseofMySQLserverwascreatedin1995whenMontyaddedanSQLinterfacetoUniregDavidandMonty,togetherwithAllanLarsson,foundedMySQLABin1995.InIn2001MySQLbegansupportingtransactionswiththeintegrationoftheBDBandInnoDBenginesOvertheyearsthefeaturesetoftheMySQLserverhasgrowntocoveralmostanyfeatureneededinanenterprisedatabaseserverMySQLServerMySQLServerProductProductMySQLServer(mysqld,MySQLMySQLMySQLMySQLQueryMySQLMySQLMigrationMySQLEmbeddedMySQLDriversandCommunityCommunityandEnterpriseserverInAugustof2007MySQLABbeganofferingtheMySQLserverintwodifferentversions:MySQLMySQLContributetoMySQLMailingUserMySQLMySQLMySQLInstallingandInstallingandAccessingMySQLServer主讲:马永亮(马哥QQ群客服QQ:2813150558,MySQL’sLogical客户存储引MySQL’sLogical客户存储引文件系线程优化分析缓连接/线程处MySQLMySQLBeforeBeforeSourcecodeinstallationandbinaryfileProblemswithVendor-SuppliedSomevendor-suppliedpackagesmaynotincludeallthefeaturesandbugfixes,becausethepackagingprocessdoesnotnecessarilyincludeallthedocumentedchanges.ChoosingtheMySQLGA(GeneralRC(ReleaseInstallingfromInstallingfromanrpmfileonMySQLRPMpackageonpackageonMySQLServerArchivePackageInitialInitialAfterinstallation,mysqldmustbeinitializedandManyMySQLprograms,includingmysqld,useacentralconfigurationfiletoallowadatabaseadministratortosetvariousparametersthatwillpersistacrossrebootsTheMySQLconfigurationfileisusedformanyMySQLprograms,includingmysqldThiscentralizedconfigurationfileallowscontrolofthebehaviorandcharacteristicsofMySQLDifferentMySQLprogramsuseoptionsfromdifferentdirectivesintheconfigurationfileForexample,mysqldusesoptionsunderthe[mysqld]directive.Clientprogramssuchasmysqlandmysqladminuseoptionsunderthe[client]Thisconfigurationfileisalsoknownasanoptionfile,becauseitcontainsoptionsandtheirvaluesmysqld--Onstartup,mysqldlooksforthisconfigurationfilemysqld--Onstartup,mysqldlooksforthisconfigurationfileinThisisdoneinaspecificorder,OnUnix-basedsystemsfollowingorderofprecedenceis/path/to/filewhen--defaults-extra-file=/path/to/fileEveniftheserverfindsaconfigurationfileinthefirstitwillstillcheckeachlocationforaconfigurationIfmorethanonefileislocated,alloptionfilesareusedbyIfmorethanonefilehasthesameoption,thelastoptionread$MYSQL_HOME$MYSQL_HOMEreferstoanoperatingsystemuserenvironmentvariable.Ifitisnotset,MySQLprogramswillsetittobethesameasthebasedirectory(basedir)bydefault,unlessthereisaffileinthedatadirectory(datadir),inwhichcasethedatadirectorywillbeThedefaults-extra-fileisusedtospecifyanadditionallocationofaconfigurationfile.Itispassedasanargumentwhenbeginningstart-upofthemysqldmysqld_safe--defaults-extra-InitialConfigurationfilesInitialConfigurationfilesonWithWindowsserversthefollowingorderofprecedenceisused:%WINDIR%\my.ini, C:\my.ini,%INSTALLDIR%\my.ini,isMySQLPost-InstallConfigurationonSettinginitialMySQLPost-InstallConfigurationonSettinginitialAllinitialaccountsarecreatedwithoutWithUnix-basedserversatotaloffiveusersarecreatedbythemysql_install_dbscriptTherearethreerootaccounts:root@,root@localhost,andtheroot@hostnameTwoanonymoususeraccounts:‘’@localhostand‘RootuserRootuserpassword#mysqladmin-uroot’new-password’-#mysqladmin-uroot-hthis_host_namepassword’new-AnotherYouhavetwomethodsofdoingthismanually:executingtheSETPASSWORDcommandorexecutingtheappropriateUPDATEstatementfollowedbyaFLUSHPRIVILEGESmysql>SETPASSWORDFOR’root’@’host_name’=mysql>UPDATEmysql.userSETPassword=WHEREUser=’root’andmysql>FLUSHAnonymousAnonymousAnonymoususersareuseraccountswithausernameofanemptystring(’’)Itisabestpracticetodroptheanonymoususersbecausethereisveryrarelyanyvalidreasontoretaintheseaccountsmysql>DROPUSERToensurethatyouhavedroppedallanonymoususers,runthefollowingquery:mysql>SELECTuser,host,passwordFROMmysql.userWHEREAccessingAccessing主讲:马永亮(马哥QQ群客服QQ:2813150558,GeneralGeneralMySQLMySQLoperatesinanetworkedenvironmentusingaclient/serverarchitectureInotherwords,acentralprogramactsasaserver,andvariousclientprogramsconnecttotheservertomakerequestsAMySQLinstallationhasthefollowingmajorMySQLServer,ormysqld,isthedatabaseserverClientMySQLnon-clientMySQLMySQLMySQLServer,ormysqld,isthedatabaseserverTheservermanagesaccesstotheactualdatabasesondiskandinmemoryMySQLServerismulti-threadedandsupportsmanysimultaneousclientconnectionsClientscanconnectviaseveralconnectionClientClientForcommunicatingwiththeservertomanipulatetheinformationinthedatabasesthattheservermanagesMySQLABprovidesseveralclientprograms.Thefollowinglistdescribesafewofthem:MySQLWorkbenchandMySQLAdministratoraregraphicalfrontendstotheservermysql isacommand-lineprogramthatactsasatext-basedfrontendfortheserver.It'susedforissuingqueriesandviewingtheresultsinteractivelyfromaterminalwindowOthercommand-lineclientsincludemysqlimportforimportingdatafiles,mysqldumpformakingbackups,mysqladminforserveradministration,andmysqlcheckforcheckingtheintegrityofthedatabasefilesMySQLMySQLnon-clientTheseareprogramsthatactindependentlyoftheTheydonotoperatebyfirstestablishingaconnectiontotheserver.myisamchkisanexample.Itperformstablecheckingandrepairoperations.Anotherprograminthiscategoryismyisampack,whichcreatescompressedread-onlyversionsofMyISAMBothutilitiesoperatebyaccessingMyISAMtablefilesdirectly,independentofthemysqlddatabaseserver.AccessingAccessingmysqldwithCommand-LineThesetoolsincludemysql,mysqladmin,andThougheachtoolperformsdifferentfunctions,theyhaveseveralcommonoptionsOftentheseoptionswillhavealongformandashortHelp----CommonOptionsforCommonOptionsforMySQLOptionsforaThe--protocoloption,ifgiven,explicitlyselectsthecommunicationprotocolthattheclientprogramshoulduseforconnectingtotheserverIftherearenoprotocol,socket,host,orportoptionsgiven,Iftherearenoprotocol,socket,host,orportoptionsgiven,socketfilewillbeusedforIfaportoptionisgivenandnohostorprotocoloptionsareasocketfileisusedtoIftheprotocolspecifiedisTCP,theconnectionwillbemadeTCP/IPevenifasocketoptionisIftheprotocolspecifiedisSOCKETandaportisgivenbuthostisgiven,asocketfileisusedtoIftheprotocolspecifiedisSOCKETandthehostoptionisgiven,asocketfileisusedtoIftheprotocolspecifiedisSOCKETandahostoptionotherlocalhostisgiven,anerroroccurs(regardlessofwhetheraoptionisIfthehost,port,andsocketoptionsareallgivenbutprotocoloptionisnot,thehostandportareOtherInadditiontothecommonoptions,themostfrequentlyusedOtherInadditiontothecommonoptions,themostfrequentlyusedoptiontomysqlisthedatabaseoption---OtherCommonOtherCommonOptionsforCommand-LineSetoptionsSetoptionsmysqlwillreadoptionsinthe[client]directiveofconfigurationfilesUsingUsingThemysqlclientprogramenablesyoutosendqueriestotheMySQLserverandreceivetheirresults.Itcanbeusedinteractivelyoritcanreadqueryinputfromafileinbatchmode:Interactivemodeisusefulforday-to-dayusage,forquickone-timequeries,andfortestinghowqueriesworkBatchmodeisusefulforrunningqueriesthathavebeenprewrittenandstoredinafile.It'sespeciallyvaluableforissuingacomplexseriesofqueriesthat'sdifficulttoentermanually,orqueriesthatneedtoberunautomaticallybyajobschedulerwithoutuserAftermysqlAftermysqlconnectstotheMySQLserver,itprintsamysql>prompttoindicatethatit'sreadytoacceptqueriesToissueaquery,enteritattheCompletethequerywithastatementterminator(typicallyaTheterminatortellsmysqlthatthestatementhasbeenenteredcompletelyandshouldbeexecutedWhenmysqlseestheterminator,itsendsthequerytotheserverandthenretrievesanddisplaystheresultThemysqlThemysqlUsefulfeaturesofThemostUsefulfeaturesofThemostusefulfeaturesofmysqlLeavethemysqlinteractiveshell(commandonly,exit,quitSpecifytheusefeaturetochangedatabaseswithinmysql,theshortformis\umysqlkeepsanin-memorylistofthecommandstypedintheSomeshellinterpreterkeysretaintheirfunctiononthemysqlcommandline,Forexample:Ctrl-deletesthepreviouswordandstoresitinaCtrl-yretrieves)thecontentsofbuffersfilledwithCtrl-uorCtrl-udeletestheentirelinepriortothecursorpositionandstoresitinabufferCtrl-amovesthecursortothebeginningofthecurrentCtrl-emovesthecursortotheendofthecurrentOnOnnon-Windowsmachines,mysqlsavescommandsinahistoryOnnon-Windowsmachines,mysqlhasatabcompletionDatabaseobjectsareloadedwhenchangingtotheTodisablethefeature,usingoneofthefollowingToenablethefeaturefornewobjects,usingoneofthefollowingCancelaquerywiththeclearCancelaquerywiththeclearcommand(clearor\dorrcommandfollowedwordcansetanewThedefaultdelimitercanbechangedbyspecifyingtheTosendacommandregardlessofthedelimiter,use\gorgo Bydefault,outputisdisplayedhorizontally.Todisplayoutputvertically,sendthecommandusingthe\GorocommandTochangeTochangethedefaultoutputdisplaytoalwaysbevertical,specifythe-Eorthe--verticaloptiontolOneofthemostuser-friendlyfeaturesisthe--auto-vertical-outputoptiontomysql.Thisoptionwilldisplayoutputhorizontallybydefault.Iftheoutputiswiderthanthewidthofyourterminal,thedisplaywillautomaticallyoutputvertically.Thevaluesofpage_programaresimilartovaluesfromthePAGERoperatingsystemenvironmentvariable.Theyincludemore,less,cut,andgrepOutputwillnowbepaginatedaswhenusingtheoperatingsystem’smorecommand.Bydefault,thepagerissettothePAGERoperatingsystemenvironmentOutputwillnowbepaginatedaswhenusingtheoperatingsystem’smorecommand.Bydefault,thepagerissettothePAGERoperatingsystemenvironmentvariable.Ifnoneisset,thedefaultistoprinttostdout(theterminalwindowyouseeonyourscreen).Toresetthepager,usethenopageror\ncommand,orsetthepagerwithnovalueOnanon-Windowsmachine,youcanescapetoashellandrunonecommandbyusingthesystemor\!UsingScriptUsingScriptFileswithmysqlcanalsoacceptinputfromaAninputfilecontainingSQLstatementstobeexecutedisknownasa"scriptfile"ora"batchfile."AscriptfileshouldbeaplaintextfilecontainingstatementsinthesameformatthatyouwouldusetoenterthestatementsinteractivelyInparticular,eachstatementmustendwithaOnewaytoprocessOnewaytoprocessascriptfileisbyexecutingitwithaSOURCEcommandfromwithinmysql:mysql>NoticethattherearenoquotesaroundthenameoftheThefilemustbelocatedontheclienthostwhereyou'rerunningmysqlTheotherwaytoexecuteascriptfileisbynamingitonthemysqlcommandline.Invokemysqlandusethe<inputredirectionoperatortospecifythefilefromwhichtoreadqueryinput:#<mysqlOutputmysqlOutputBydefault,mysqlproducesoutputinoneoftwoformats,dependingonwhetheryouuseitininteractiveorbatchmodeToselectanoutputformatdifferentfromeitherofthedefaultformats,usetheseoptions:--htmlor-ProduceoutputinHTML--xmlor-ProduceoutputinXMLWhenWhenyouissueanSQLstatementwhilerunningmysql,theprogramsendsthestatementtotheMySQLservertobeexecutedSELECT,INSERT,UPDATE,andDELETEareexamplesofthistypeofinputmysqlalsounderstandsanumberofitsowncommandsthataren'tSQLstatementsQUIT,SOURCE,STATUSandsoAfulllistofmysqlcommandscanbeobtainedusingtheHELPcommandUsingServer-SideUsingServer-Side Themysqlprogramcanaccessserver-sidehelp.Thatis,youcanperformlookupsintheelfraparticulartopic,rightfromthemysql>Thegeneralsyntaxforaccessingserver-sidehelpisHELPkeywordUsingUsingthe--safe-updatesIt'spossibletoinadvertentlyissuestatementsthatmodifymanyrowsinatableorthatreturnextremelylargeresultsetsThe--safe-updatesoptionhelpspreventtheseproblems.TheoptionisparticularlyusefulforpeoplewhoarejustlearningtouseMySQL.--safe-updateshasthefollowingeffects:UPDATEandDELETEstatementsareallowedonlyiftheyincludeaWHEREclausethatspecificallyidentifieswhichrecordstoupdateordeletebymeansofakeyvalue,oriftheyincludeaLIMITclauseOutputfromsingle-tableSELECTstatementsisrestrictedtonomorethan1,000rowsunlessthestatementincludesaLIMITclauseUsedUsedtoperformadministrativeSomeofthetasksincludecreatinganddroppingdatabases,displayingserverconfiguration,currentstatusinformation,changingapassword,andstoppingaserver.mysqladmincanbeveryusefulinscriptingmysqladmin[options]command[arg][command[arg]]mysqladminCommandmysqladminCommandmysqladminmysqladminUsedtoreturnsomebasicinformationfrommysqldincludinguptime,currentnumberofthreads,andqueriespersecondbeingexecutedCancombinethestatuscommandwiththe--sleepoptiontohavemysqladminpauseforthespecifiednumberofsecondsandthendisplayupdatedstatusinformation.Unlessyouspecifythe--countoption(whichonlyworksinconjunctionwiththe--sleepoption)GUIGUINavicatforMySQLMySQLQueryMySQLMySQLTheSQLyo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 护理查房最佳实践
- 皮毛市场项目可行性研究报告
- 竹缠绕复合管生产建设项目可行性研究报告
- 2026年企业公关与危机处理试题
- 2026年妇联所属家政服务企业培训岗面试题
- 社会心理学试题及答案解析2026
- 致时代向前的我们演讲稿
- 2026年秋招市场分析岗位面试模拟题集
- 起重机培训课件
- 2026年天津市人民医院儿童介入治疗混合型先心病杂交手术模拟试题
- 如何提高学生的思维能力
- 苏州市2022-2023学年高二下学期期中考试地理试卷(学生版)
- 边缘型人格障碍护理课件
- 引水隧洞回填固结灌浆施工方案
- 马克思主义文艺论著选讲
- 医院药品评价与遴选量化评分表
- 公共数据共享安全保密协议模板
- 微生物次级代谢及调节
- 高级英语unit12-I-have-a-dream我有一个梦想
- GB/T 97.1-2002平垫圈A级
- GB/T 706-2016热轧型钢
评论
0/150
提交评论