版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
主讲主讲:马永亮(马哥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重庆市铜梁区市民服务和营商环境促进中心公益性岗位招聘3人模拟试卷附参考答案详解【巩固】
- 遂宁市邮政管理局招聘工作人员的备考题库附参考答案详解【研优卷】
- 2026浙江舟山群岛新区六横管理委员会招聘1人模拟试卷含答案详解【基础题】
- 2026年山东省潍坊市社区工作者招聘考试备考试题及答案详解
- 2026浙江嘉兴市平湖市时尚产业商贸有限公司面向社会招聘1人考试备考试题及答案详解
- 2026青岛检测认证集团有限公司招聘笔试参考题库及答案详解
- 2026年杭州萧山区第一人民医院招聘编外人员20人考试备考试题及答案详解
- 2026年延安志丹县高级中学教师招聘(16人)备考题库含答案详解【预热题】
- 2026中国中医科学院中药资源中心招聘2人笔试备考试题及答案详解
- 混凝土蓄水池施工方案
- 2023-2024学年北京市海淀区七年级下学期期末英语试题(含答案)
- 四年级下册数学最难的应用题
- 果蔬罐头加工技术(果蔬制品加工课件)
- 行政处罚法(课件)-图文
- 《SolidWorks三维建模》课程教学标准(含课程思政)
- 专题2 焦长焦比体系
- 怎样收纳整理物品PPT教学课件
- GB/T 40681.5-2021生产过程能力和性能监测统计方法第5部分:计数特性的过程能力和性能估计
- GB/T 10432.1-2010电弧螺柱焊用无头焊钉
- 《粮油加工学》课件
评论
0/150
提交评论