Linux CentOs7用rpm的方式安装和卸载mysql

一、安装

1、创建目录并进入

mkdir /opt/mysql5.7 && cd /opt/mysql5.7

2、下载mysql5.7.15版本

wget https://downloads.mysql.com/archives/get/file/mysql-5.7.15-1.el7.x86_64.rpm-bundle.tar(下载时间较长,请耐心等候)

tar -xvf mysql-5.7.15-1.el7.x86_64.rpm-bundle.tar

rpm -ivh mysql-community-common-5.7.15-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.15-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.15-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.15-1.el7.x86_64.rpm

vim /etc/my.cnf

6、在my.cnf的[mysqld]代码下方添加skip-grant-tables(目的是为了首次登录时不用输入密码)

service mysqld start

netstat -apln | grep mysql

mysql

update mysql.user set authentication_string = password(‘123456′),host=’%’ where user = ‘root’;

flush privileges;

 

至此,完成rpm包安装mysql

 

二、解决安装时的 错

1、在第四步执行rpm-ivh mysql-community-common-5.7.15-1.el7.x86_64.rpm的时候 错

警告:mysql-community-common-5.7.15-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中…                          ################################# [100%]
    file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.15-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86
_64    file /usr/share/mysql/danish/errmsg.sys from install of mysql-community-common-5.7.15-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x8
6_64    file /usr/share/mysql/dutch/errmsg.sys from install of mysql-community-common-5.7.15-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x86
_64    file /usr/share/mysql/english/errmsg.sys from install of mysql-community-common-5.7.15-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.60-1.el7_5.x
86_64

原因:已存在mariadb-libs-1:5.5.60-1.el7_5.x86_64的库(这是linux自带的)所以需要先删除以前的库才能安装!

解决方法:

①、先查询时候安装了mariadb

②、卸载mariadb

三、卸载

1、关闭mysql服务

service mysqld stop

rpm -aq | grep -i  mysql

rpm -ev mysql-community-server-5.7.15-1.el7.x86_64
rpm -ev mysql-community-client-5.7.15-1.el7.x86_64
rpm -ev mysql-community-libs-5.7.15-1.el7.x86_64 –nodeps(忽略依赖 –nodeps)
rpm -ev mysql-community-common-5.7.15-1.el7.x86_64

 find / -name “mysql”

rm -rf /etc/selinux/targeted/active/modules/100/mysql /var/lib/mysql /var/lib/mysql/mysql /usr/share/mysql

 

至此MySQL删除完成

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

文章知识点与官方知识档案匹配,可进一步学习相关知识CS入门技能树Linux入门在线安装软件25126 人正在系统学习中

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2019年7月25日
下一篇 2019年7月25日

相关推荐