cd ~/ && cat /etc/redhat-release yum list installed |grep mysql #<===查看是否安装mysql,如果已经安装,使用rpm -e --nodeps卸载 wget -c http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm wget -c http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm cd /etc/yum.repos.d/ ls rpm -ivh ~/mysql-community-release-el6-5.noarch.rpm rpm -ivh ~/mysql-community-release-el7-5.noarch.rpm ls yum repolist all |grep mysql #<===查看是否有mysql-5.6对应的安装文件 yum -y install mysql-community-server #<===安装mysql-5.6 yum list installed |grep mysql #<===查看mysql-5.6已经成功安装 find / -type d -name "mysql" #<===查看yum安装后mysql目录的位置 cat /etc/my.cnf #<===查看mysql配置文件my.cnf,很简单,但可以使用其启动mysql systemctl start mysqld #<===启动mysqld服务 /sbin/chkconfig --level 3 mysqld on #<===加入开机自启动 mysql -uroot -p #<===空密码登录成功 yum list installed |grep mysql #<===查看yum安装的软件包 rpm -ql mysql-community-server.x86_64 #<===查看软件包所在路径
小结:
- yum 安装软件真的很方便,没有特定实际需求,没必要编译安装,太费劲
- 有空需要学习制作二进制rpm包和yum仓库