《MySQL数据库培训手册.docx》由会员分享,可在线阅读,更多相关《MySQL数据库培训手册.docx(15页珍藏版)》请在三一办公上搜索。
1、IT和)朝一期)Hf)8Wt甚苏tT ForadviceonhowtoChAn9settingsplsm4http:/cv.maql,ccg*/dec/.f林n5.6/n/8工W-CQ口*guratfoG RemoveleadingandsottotheaaountofRAMforthe三ostimportantdatatCAChoinMySQ1.Startat70%oftotalRAMforovqloading*toturnonavryimportantdataintegrityoption:loggingIchangestothebinaryI09betwMnbackups.kip-nam
2、o-ro驾olVOAyiqamCoVOXr;daaultTheseereCeaDBOnlyetrremovetheandsetasrequired.IlbasodirI*dacadir=/uar/local/apAche/htdocs/lcOyUnIPoXt56788IS*server-id*socket三 Re11voleadingtosotoptionsmainlyusefulforreportingservers.ThosorvordefaultsarefasterfortransactionsandfastSXXCTs.Adjustsizesasn*dd,erimnttofindtho
3、ptimalvlua. join-buffer-size126M2taort_buffor_siza2Mroadrndbuffersize三2M29kqldoNOENGZNZSUBSTXTl7rXCNrSTRXCTTFANSTAB1.ES彳;innodb-buffer-pool-izeIGJ21.nncdb_additional_mea_pool_5izow64M33*Set.Jogiljizoto25ofbufferpoolflizoNinnotb-logfile-ix-25Mtinnodbloq-buffor-sio-0M2tinnodbflushlogattrxccomit=1391.n
4、nodb-lock-wait-timeout50039InnOdbfiloPOrtableU822U-mP如中如fa2Sb1)(rot1flguibw)qVurootpEnterpassword:MeUomtothMyS(Xaonitor.CombtdMdwith:org.YoUrHySQ1.crAetlervr*ion:$.6.14ntrpri-c三rVdvcdWySOl(ht11rivSrvr-AdrncdEdition(Cowci1CopyriQht(C)20,2913,Oroclarvd/oritsaffiliates.Allrightsresrvd.Orclitarg19tr9dtr
5、dwrkofOrCorporationndoritsaffiliates.OtMrnam5mybtrdar5ofthrrspctiYo*mrs.TypcreateuserIliU式l,O图identifiedby口23456;QueryOK,Orowsaffected(.sec)mysqlselecthost,user,passwordfromuser;IhostIuserpasswordIXocalhostroot6BB4837EB7432915EE4568DDA7DC67E02CA2AD9IguiIrootB181E9A8914B9EB137FED146CA6378630F4A86CI12
6、7.1Iroot*B181E9A80914B9EB137FED146CA6378630F4A86CI:1IrootIB181E9A80914B9EB137FED146CA6378630F4A86CI127.1INiord2FB13B0413A2DE1373E356BC89FFF95CCFE8257IINiord*2FB13BO0413A2DE1373E356BC89FFF95CCFE8257IlocalhostNiorda2FB13B0413A2DE1373E356BC89FFF95CCFE8257IrmItwjbnau:i【:耳=之耳】B7niJ=hgrantallon*.*to,Iiusl
7、,0,%,;QueryOK,0rowsaffected(0.00sec)NwugtpcognBnjquvn=三ysqlshowgrantsforUusV,:ICmtsforUusUIGU11AiFMW1.EGESOK.三TOUvsl,V11e11IFiaBYPASSm)688483737432915eE4568WA7K67B2O2W9,1rowinset(.Msec)mysql.setpasswordorIiusi(d,%=password(,iqazQueryOK,rowsaffected(.0sec)mysqlselecthost,user,passwordfromuser;host+Iu
8、ser.4.v.+I.x.passwordlocalhostIrootI*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9guiIrootI*B181E9A80914B9EB137FED146CA637863F4A86C127.0.G.lIrootI*B181E9A8914B9EB137FED146CA637863F4A86C:1IrootI*B181E9A80914B9EB137FED146CA6378630F4A86C127.0.0.1INiordI*2FB13B0413A2DE1373E356BC89FFF95CCFE8257%INiordI*2FB13B
9、413A2DE1373E356BC89FFF95CCFE8257IocalhostINiordI*2FB13B00413A2DE1373E356BC89FFF95CCFE8257IocalhostIISlI6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9%IIiusX4.I展4.*F337D98B7FC3A22DDE19392E2C46C1353DBC69mysqldropuser,Iiusl,*;QueryOK,rowsaffected(.00sec)mysqselecthost,user,passwordfromuser;hostIuserP.Ipasswo
10、rdIocalhostIroot,TI*6BB4837EB7432915EE4568DDA7DC67ED2CA2AD9guiIrootI*B181E9A80914B9EB137FED146CA6378630F4A86C127.lIrootI*B181E9A8914B9EB137FED146CA6378630F4A86C:1IrootI*B181E9A8914B9EB137FED146CA6378630F4A86C127.lINiordI*2FB13B00413A2DE1373E356BC89FFF95CCFE8257%INiordI*2FB13B0413A2DE1373E356BC89FFF9
11、5CCFE8257localhostINiordI*2FB13B413A2DE1373E356BC89FFF95CCFE8257IocalhostIIsl+ICtrl-C-exit!Abortedroot0guibin#etcinit.d/mysqlrestartShuttingdownMySQ1.SUCCESS!StartingMySQ1.SUCCESS!rootguibin#mysqlshowdatabases;IDatabase+-+Iinformation_schemaIdocmanagerIIiushuolinImysqlIperformance_schematest6rowsins
12、et(0.00sec)mysquseIiushuolin;ReadingtableinformationforcompletionoftableandcolumnnamesYoucanturnoffthisfeaturetogetaquickerstartupwith-ADatabasechangedmysqlshowtables;ITabIeS_in_liushuolinIstudentIteachers2rowsinset(0.0。sec)&amysqldescstudent;IFieldTypeNullKeyDefaultExtraInamechar(l)NOPRINU1.1.1 hob
13、byvarchar(10)YESNU1.1.+2 rowsinset(0.01sec)?nIb9CbViIfB鼻UN0Qaaa加由n物H*bBlOH9-2-9-2-BIbbb0Bl&m09NWQ-fgngvghtzqouvwfgpv,yjgt:g,pcog?NyI二林B)EP/如t.tEP/7e7mysqllcreateindexhelloonstudentobby);QueryOK,0rowsaffected(0.31sec)Records:Duplicates:Warnings:0mysqldescstudent;HFieldI卜十.ITypeINull卜+KeyIDefaultExtra
14、nameIchar(10)NOIPRIINU1.1.IhobbyIIvarchar(10)YESMU1.INU1.1.InumberIfloat(5,3)IYESINU1.1.I+H卜+3rowsinset(0.00sec)bysqlaertablestudentaddunique(number);QueryOK,rowsaffeeted(.34sec)Records:Duplicates:0Warnings:0nysqldescstudent;1.-I-A-I-I-q11IFieldHInameIhobbyInumberX.JITypeINull卜4Ichar(l)NOIvarchar(10
15、)YESIfloat(5,3)IYESU_A-Jr11KeyI卜HPRlI三11.JIDefaultbHINU1.1.INU1.1.INU1.1.UJIExtra卜+IIII1.-X-Browsinset(.sec)nysqlaltertablestudentaddfulltext(hobby)dQueryOK,t)rowsaffected,1warnngTl.27sec)Records:Duplicates:0Warnings:1nysqldescstudent;.4.IFieldTypeNull.IKeyIDefaultIExtraI+,+Inamechar(10)NOIPRIINU1.1
16、.IIIhobbyvarchar(10)YEStt1.NU1.1.IIInumberfloat(5,3)YESIUNIINU1.1.IIH+3rowsinset(0.00sec)+5S3-0-0*feQtiDag64Aas吗ttxxxJNavicatPremium快捷式0C580字节SmMa&Bl3sNnunN12n.HIb9N1nN333nhsCfG&0,SS*tt*SRttScreateorreplacetriggerSYSDBA1.TESTafterINSERTon,SYSDBA.321referencingO1.DROWAS-O1.D-NEWROWASNEWforeachrowBEGI
17、N触发器体/InsertintoSYSDBAnZSIZuCycnZbab/)values(!new.wjew.heilo);END;UPDATE触发器:createorreplacetriggerSYSDBA.UPDAafterUPDATEonSYSDBA.32referencingO1.DROWASO1.DNEWROWASNEWforeachrowBEGINupdate312setyc-:O1.D.wjx;END;DE1.rrEit发器:createorreplacetriggermSYSDBAo.mDE1.EmafterDE1.ETEonSYSDBAm.321referencingO1.DROWASO1.DNEWROWASmNEWmforeachrowBEGIN7(br三三/SxSS/deletefromtt312,twherewyclf-iO1.D.lwjx;END;女MZflOEtraMZ18nBM)O*nff(BCdIftnzBUUtut”SOOt0lA4-M3TCCRAM5_WnR11N.TrBlHMIdl