12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-24 19:12:32
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
一、安装环境1、操作系统版本:Red Hat Enterprise Linux Server release 6.5 (Santiago)2、Mysql版本:MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar
二、安装说明网上不少资料在
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
一、安装环境
1、操作系统版本:Red Hat Enterprise Linux Server release 6.5 (Santiago)
2、Mysql版本:MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar
二、安装说明
网上不少资料在使用rpm包安装Mysql 5.6之前,都会先卸载系统自带的mysql-libs,但有的资料是用yum remove mysql,但这样会把依赖mysql-libs的8个包也一同卸载,其中就包括postfix、crontab等软件包,造成了非预期目的的卸载,有的资料就使用rpm -e --nodeps mysql-libs来避免卸载其他依赖mysql-libs的软件包,但是也并非完全正确的做法,Mysql官方提供的Mysql-shared-compat正是替代mysql-libs的rpm包,应先安装此包,再单独卸载mysql-libs,官方说明如下:
解压MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar后,可以看到包含了多个rpm包文件
网上不少资料都选择了安装Mysql-server、Mysql-client和Mysql-devel三个包,但实际上Mysql-devel的作用是如果需要编译其他mysql客户端例如perl mysql模块或者打算编译C API应用程序,实际上大多数情况下标准安装并不需要安装Mysql-devel,只需要按照Mysql-server和Mysql-client就行,本文就是这样安装。官网的介绍如下:
三、安装过程
1、首先安装一下Mysql-shared-compat,再单独卸载mysql-libs。
2、安装mysql-server,根据提示安装完成后的随机密码在/root/.mysql_secret,并且可以运行安全配置向导/usr/bin/mysql_secure_installation,还有配置文件在/usr/my.cnf(按习惯一般拷贝到/etc/my.cnf)
[root@node01mysqlrpm]#rpm-ivhMySQL-server-5.6.38-1.el6.x86_64.rpmwarning:MySQL-server-5.6.38-1.el6.x86_64.rpm:HeaderV3DSA/SHA1Signature,keyID5072e1f5:NOKEYPreparing...###########################################[100%]1:MySQL-server###########################################[100%]warning:usermysqldoesnotexist-usingrootwarning:groupmysqldoesnotexist-usingrootwarning:usermysqldoesnotexist-usingrootwarning:groupmysqldoesnotexist-usingroot2017-10-2820:57:240[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).2017-10-2820:57:240[Note]Ignoring--secure-file-privvalueasserverisrunningwith--bootstrap.2017-10-2820:57:240[Note]/usr/sbin/mysqld(mysqld5.6.38)startingasprocess8869...2017-10-2820:57:248869[Note]InnoDB:Usingatomicstorefcountbufferpoolpages2017-10-2820:57:248869[Note]InnoDB:TheInnoDBmemoryheapisdisabled2017-10-2820:57:248869[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins2017-10-2820:57:248869[Note]InnoDB:Memorybarrierisnotused2017-10-2820:57:248869[Note]InnoDB:Compressedtablesusezlib1.2.32017-10-2820:57:248869[Note]InnoDB:UsingLinuxnativeAIO2017-10-2820:57:248869[Note]InnoDB:UsingCPUcrc32instructions2017-10-2820:57:248869[Note]InnoDB:Initializingbufferpool,size=128.0M2017-10-2820:57:248869[Note]InnoDB:Completedinitializationofbufferpool2017-10-2820:57:248869[Note]InnoDB:Thefirstspecifieddatafile./ibdata1didnotexist:anewdatabasetobecreated!2017-10-2820:57:248869[Note]InnoDB:Settingfile./ibdata1sizeto12MB2017-10-2820:57:248869[Note]InnoDB:Databasephysicallywritesthefilefull:wait...2017-10-2820:57:258869[Note]InnoDB:Settinglogfile./ib_logfile101sizeto48MB2017-10-2820:57:268869[Note]InnoDB:Settinglogfile./ib_logfile1sizeto48MB2017-10-2820:57:278869[Note]InnoDB:Renaminglogfile./ib_logfile101to./ib_logfile02017-10-2820:57:278869[Warning]InnoDB:Newlogfilescreated,LSN=457812017-10-2820:57:278869[Note]InnoDB:Doublewritebuffernotfound:creatingnew2017-10-2820:57:278869[Note]InnoDB:Doublewritebuffercreated2017-10-2820:57:278869[Note]InnoDB:128rollbacksegment(s)areactive.2017-10-2820:57:278869[Warning]InnoDB:Creatingforeignkeyconstraintsystemtables.2017-10-2820:57:278869[Note]InnoDB:Foreignkeyconstraintsystemtablescreated2017-10-2820:57:278869[Note]InnoDB:Creatingtablespaceanddatafilesystemtables.2017-10-2820:57:278869[Note]InnoDB:Tablespaceanddatafilesystemtablescreated.2017-10-2820:57:278869[Note]InnoDB:Waitingforpurgetostart2017-10-2820:57:278869[Note]InnoDB:5.6.38started;logsequencenumber0Arandomrootpasswordhasbeenset.Youwillfinditin'/root/.mysql_secret'.2017-10-2820:57:288869[Note]Binlogend2017-10-2820:57:288869[Note]InnoDB:FTSoptimizethreadexiting.2017-10-2820:57:288869[Note]InnoDB:Startingshutdown...2017-10-2820:57:298869[Note]InnoDB:Shutdowncompleted;logsequencenumber16259772017-10-2820:57:290[Warning]TIMESTAMPwithimplicitDEFAULTvalueisdeprecated.Pleaseuse--explicit_defaults_for_timestampserveroption(seedocumentationformoredetails).2017-10-2820:57:290[Note]Ignoring--secure-file-privvalueasserverisrunningwith--bootstrap.2017-10-2820:57:290[Note]/usr/sbin/mysqld(mysqld5.6.38)startingasprocess8891...2017-10-2820:57:298891[Note]InnoDB:Usingatomicstorefcountbufferpoolpages2017-10-2820:57:298891[Note]InnoDB:TheInnoDBmemoryheapisdisabled2017-10-2820:57:298891[Note]InnoDB:Mutexesandrw_locksuseGCCatomicbuiltins2017-10-2820:57:298891[Note]InnoDB:Memorybarrierisnotused2017-10-2820:57:298891[Note]InnoDB:Compressedtablesusezlib1.2.32017-10-2820:57:298891[Note]InnoDB:UsingLinuxnativeAIO2017-10-2820:57:298891[Note]InnoDB:UsingCPUcrc32instructions2017-10-2820:57:298891[Note]InnoDB:Initializingbufferpool,size=128.0M2017-10-2820:57:298891[Note]InnoDB:Completedinitializationofbufferpool2017-10-2820:57:298891[Note]InnoDB:HighestsupportedfileformatisBarracuda.2017-10-2820:57:298891[Note]InnoDB:128rollbacksegment(s)areactive.2017-10-2820:57:298891[Note]InnoDB:Waitingforpurgetostart2017-10-2820:57:298891[Note]InnoDB:5.6.38started;logsequencenumber16259772017-10-2820:57:298891[Note]Binlogend2017-10-2820:57:298891[Note]InnoDB:FTSoptimizethreadexiting.2017-10-2820:57:298891[Note]InnoDB:Startingshutdown...2017-10-2820:57:318891[Note]InnoDB:Shutdowncompleted;logsequencenumber1625987ARANDOMPASSWORDHASBEENSETFORTHEMySQLrootUSER!Youwillfindthatpasswordin'/root/.mysql_secret'.Youmustchangethatpasswordonyourfirstconnect,nootherstatementbut'SETPASSWORD'willbeaccepted.Seethemanualforthesemanticsofthe'passwordexpired'flag.Also,theaccountfortheanonymoususerhasbeenremoved.Inaddition,youcanrun:/usr/bin/mysql_secure_installationwhichwillalsogiveyoutheoptionofremovingthetestdatabase.Thisisstronglyrecommendedforproductionservers.Seethemanualformoreinstructions.Pleasereportanyproblemsathttp://bugs.mysql.com/ThelatestinformationaboutMySQLisavailableonthewebathttp://www.mysql.comSupportMySQLbybuyingsupport/licensesathttp://shop.mysql.comNewdefaultconfigfilewascreatedas/usr/my.cnfandwillbeusedbydefaultbytheserverwhenyoustartit.Youmayeditthisfiletochangeserversettings
3、安装Mysql-client
4、复制my.conf并启动服务
[root@node01 mysqlrpm]# cp /usr/my.cnf /etc/my.cnf
5、RPM包安装后的目录结构如下:
四、初始化配置Mysql并登录数据库
1、网上很多资料在RPM安装完Mysql 5.6后还执行了/usr/bin/mysql_install_db进行初始化安装但安全配置向导却没运行,实际上在Mysql 5.6.8开始,用RPM包全新安装时会调用/usr/bin/mysql_install_db并带上随机密码参数,因此并不需要再执行mysql_install_db,反而运行安全配置向导很有必要。官网说明如下:
2、运行安全配置向导,由于需要输入root密码,因此先查看一下随机生成的密码文件。
[root@node01~]#cat/root/.mysql_secret#TherandompasswordsetfortherootuseratSatOct2820:57:282017(localtime):LyE_R5rVp7p1vLMe
安全配置向导主要执行以下操作:
a)是否为root用户设置密码
b)是否删除匿名账号
c)是否取消root用户远程登录
d)是否删除test库和对test库的访问权限
e)是否刷新授权表使修改生效
[root@node01~]#cat/root/.mysql_secret#TherandompasswordsetfortherootuseratSatOct2820:57:282017(localtime):LyE_R5rVp7p1vLMe[root@node01~]#/usr/bin/mysql_secure_installationNOTE:RUNNINGALLPARTSOFTHISSCRIPTISRECOMMENDEDFORALLMySQLSERVERSINPRODUCTIONUSE!PLEASEREADEACHSTEPCAREFULLY!InordertologintoMySQLtosecureit,we'llneedthecurrentpasswordfortherootuser.Ifyou'vejustinstalledMySQL,andyouhaven'tsettherootpasswordyet,thepasswordwillbeblank,soyoushouldjustpressenterhere.Entercurrentpasswordforroot(enterfornone):OK,successfullyusedpassword,movingon...SettingtherootpasswordensuresthatnobodycanlogintotheMySQLrootuserwithouttheproperauthorisation.Youalreadyhavearootpasswordset,soyoucansafelyanswer'n'.Changetherootpassword?[Y/n]yNewpassword:Re-enternewpassword:Passwordupdatedsuccessfully!Reloadingprivilegetables.....Success!Bydefault,aMySQLinstallationhasananonymoususer,allowinganyonetologintoMySQLwithouthavingtohaveauseraccountcreatedforthem.Thisisintendedonlyfortesting,andtomaketheinstallationgoabitsmoother.Youshouldremovethembeforemovingintoaproductionenvironment.Removeanonymoususers?[Y/n]y...Success!Normally,rootshouldonlybeallowedtoconnectfrom'localhost'.Thisensuresthatsomeonecannotguessattherootpasswordfromthenetwork.Disallowrootloginremotely?[Y/n]n...skipping.Bydefault,MySQLcomeswithadatabasenamed'test'thatanyonecanaccess.Thisisalsointendedonlyfortesting,andshouldberemovedbeforemovingintoaproductionenvironment.Removetestdatabaseandaccesstoit?[Y/n]n...skipping.Reloadingtheprivilegetableswillensurethatallchangesmadesofarwilltakeeffectimmediately.Reloadprivilegetablesnow?[Y/n]y...Success!Alldone!Ifyou'vecompletedalloftheabovesteps,yourMySQLinstallationshouldnowbesecure.ThanksforusingMySQL!Cleaningup...
3、登录数据库,确认安装成功完成
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19