阿里云Centos下安装mysql找不到mysql-sever安装包的解决方案

解决方案

  • 采用yum源安装,yum install mysql mysql-sever mysql-client很多教程上都这么写,实际上也是对的,对于大多数centos系统默认源来讲,确实如此。
  • 但是在阿里云服务器上,默认是阿里云自己配置的yum源 ,所以上述方法就会出问题,因为人家的yum源里面根本就没有这些东西。可能是包名改了吧,反正不是我们熟悉的那些。
  • 所以可以使用wget命令从官网上直接下载,就有了这么一种方法。
    • wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  • 从官网上下载后会发现本地路径已经有了rpm包。这时候利用rpm命令将rpm包导入到yum源里面去
    • rpm -ivh mysql-community-release-el7-5.noarch.rpm
  • 然后利yum install mysql-community-server.x86_64命令安装
  • 一路狂奔,安装好后使用mysql,还是不可以,因为mysqld服务没有开启。这时候使用service mysqld start然后安装结束,mysql正常开启。
  • 使用mysql直接进入数据库里面,但是这样一来不是都可以进去了?,这时候我们要做的就是加buff保护,也就是给数据库设密码。
    • mysqladmin -u root -p password 你的密码
  • 完成后,若已经设置了密码,需要输入原密码修改,若未设置密码,那么上一步完成后就修改完成
  • 登录的时候也不能使用mysql进入了,估计也进不去,因为有暗号了,哈哈哈
  • 这个时候使用mysql -u root/你的密码就可以进去了。到此安装就说完了。

对于rpm命令

  • 若是不熟悉可以使用man命令查看说明
    在此我把rpm的说明贴出来,来说明其作用


RPM(8)                                                            System Manager's Manual                                                            RPM(8)

NAME
       rpm - RPM Package Manager

SYNOPSIS
   QUERYING AND VERIFYING PACKAGES:
       rpm {-q|--query} [select-options] [query-options]

       rpm {-V|--verify} [select-options] [verify-options]

   INSTALLING, UPGRADING, AND REMOVING PACKAGES:
       rpm {-i|--install} [install-options] PACKAGE_FILE ...

       rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...

       rpm {-F|--freshen} [install-options] PACKAGE_FILE ...

       rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts]
           [--notriggers] [--test] PACKAGE_NAME ...

   MISCELLANEOUS:
       rpm {--querytags|--showrc}

       rpm {--setperms|--setugids} PACKAGE_NAME ...

   select-options
        [PACKAGE_NAME] [-a,--all] [-f,--file FILE]
        [-g,--group GROUP] {-p,--package PACKAGE_FILE]
        [--hdrid SHA1] [--pkgid MD5] [--tid TID]
        [--querybynumber HDRNUM] [--triggeredby PACKAGE_NAME]
        [--whatprovides CAPABILITY] [--whatrequires CAPABILITY]

   query-options
        [--changelog] [-c,--configfiles] [--conflicts]
        [-d,--docfiles] [--dump] [--filesbypkg] [-i,--info]
        [--last] [-l,--list] [--obsoletes] [--provides]
        [--qf,--queryformat QUERYFMT] [-R,--requires]
        [--scripts] [-s,--state] [--triggers,--triggerscripts]

   verify-options
        [--nodeps] [--nofiles] [--noscripts]
        [--nodigest] [--nosignature]
        [--nolinkto] [--nofiledigest] [--nosize] [--nouser]
        [--nogroup] [--nomtime] [--nomode] [--nordev]
        [--nocaps]

   install-options
        [--allfiles] [--badreloc] [--excludepath OLDPATH]
        [--excludedocs] [--force] [-h,--hash]
        [--ignoresize] [--ignorearch] [--ignoreos]
        [--includedocs] [--justdb] [--nocollections]
        [--nodeps] [--nodigest] [--nosignature]
        [--noorder] [--noscripts] [--notriggers]
        [--oldpackage] [--percent] [--prefix NEWPATH]
        [--relocate OLDPATH=NEWPATH]
        [--replacefiles] [--replacepkgs]
        [--test]

DESCRIPTION
       rpm  is  a  powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages.  A package
       consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts,  file  attributes,
       and  descriptive  information about the package.  Packages come in two varieties: binary packages, used to encapsulate software to be installed, and
       source packages, containing the source code and recipe necessary to produce binary packages.

       One of the following basic modes must be selected: Query, Verify, Install/Upgrade/Freshen, Uninstall, Set Owners/Groups, Show  Querytags,  and  Show
       Configuration.

   GENERAL OPTIONS
       These options can be used in all the different modes.

       -?, --help
              Print a longer usage message then normal.

       --version
              Print a single line containing the version number of rpm being used.

       --quiet
              Print as little as possible - normally only error messages will be displayed.

       -v     Print verbose information - normally routine progress messages will be displayed.

       -vv    Print lots of ugly debugging information.

       --rcfile FILELIST
              Each of the files in the colon separated FILELIST is read sequentially by rpm for configuration information.  Only the first file in the list
              must  exist,  and  tildes  will  be  expanded  to  the  value  of  $HOME.   The  default  FILELIST  is   /usr/lib/rpm/rpmrc:/usr/lib/rpm/red‐
              hat/rpmrc:/etc/rpmrc:~/.rpmrc.

       --pipe CMD
              Pipes the output of rpm to the command CMD.

       --dbpath DIRECTORY
              Use the database in DIRECTORY rather than the default path /var/lib/rpm

       --root DIRECTORY
              Use  the file system tree rooted at DIRECTORY for all operations.  Note that this means the database within DIRECTORY will be used for depen‐
              dency checks and any scriptlet(s) (e.g.  %post if installing, or %prep if building, a package) will be run after a chroot(2) to DIRECTORY.

  
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值