mysql5.7版本的6种
发布时间:2022-12-11 21:16:14 来源:文档文库
小
中
大
字号:
拥有的6种Tablespaces1.systemtablespaceTheInnoDBsystemtablespacecontainstheInnoDBdatadictionary(metadataforInnoDB-relatedobjectsandisthestorageareaforthedoublewritebuffer,thechangebuffer,andundologs.Thesystemtablespacealsocontainstableandindexdataforanyuser-createdtablesthatarecreatedinthesystemtablespace.Thesystemtablespaceisconsideredasharedtablespacesinceitissharedbymultipletables.Thesystemtablespaceisrepresentedbyoneormoredatafiles.Bydefault,onesystemdatafile,namedibdata1,iscreatedintheMySQLdatadirectory.Thesizeandnumberofsystemdatafilesiscontrolledbytheinnodb_data_file_pathstartupoption.增大系统表空间TheeasiestwaytoincreasethesizeoftheInnoDBsystemtablespaceistoconfigureitfromthebeginningtobeauto-extending.Specifytheautoextendattributeforthelastdatafileinthetablespacedefinition.ThenInnoDBincreasesthesizeofthatfileautomaticallyin64MBincrementswhenitrunsoutofspace.Theincrementsizecanbechangedbysettingthevalueoftheinnodb_autoextend_incrementsystemvariable,whichismeasuredinmegabytesYoucanexpandthesystemtablespacebyadefinedamountbyaddinganotherdatafile:1.ShutdowntheMySQLserver.2.Ifthepreviouslastdatafileisdefinedwiththekeywordautoextend,change
itsdefinitiontouseafixedsize,basedonhowlargeithasactuallygrown.Checkthesizeofthedatafile,rounditdowntotheclosestmultipleof1024×1024bytes(=1MB,andspecifythisroundedsizeexplicitlyininnodb_data_file_path.3.Addanewdatafiletotheendofinnodb_data_file_path,optionallymakingthatfilethelastdatafileintheinnodb_data_file_pathcanbespecifiedasautoextending.4.StarttheMySQLserveragain.Forexample,thistablespacehasjustoneauto-extendingdatafileibdata1:>>>>>innodb_data_home_dir=innodb_data_file_path=/ibdata/ibdata1:10M:autoextendSupposethatthisdatafile,overtime,hasgrownto988MB.Hereistheconfigurationlineaftermodifyingtheoriginaldatafiletouseafixedsizeandaddinganewauto-extendingdatafile:>>>>>innodb_data_home_dir=innodb_data_file_path=/ibdata/ibdata1:988M;/disk2/ibdata2:50M:autoextendWhenyouaddanewdatafiletothesystemtablespaceconfiguration,makesurethatthefilenamedoesnotrefertoanexistingfile.InnoDBcreatesandinitializesthefilewhenyourestarttheserver.缩小系统表空间