操作系统

当前位置:金沙棋牌 > 操作系统 > 使用rpm安装XtraBackup问题总结,Linux如何查看YUM的

使用rpm安装XtraBackup问题总结,Linux如何查看YUM的

来源:http://www.logblo.com 作者:金沙棋牌 时间:2019-12-09 08:06

Linux下如何查看使用YUM安装过的包的安装路径呢? 在搞清楚这个问题前,我们先来了解一下YUM。 YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,避免了手动安装的麻烦(寻找资源、下载;放到指定目录安装;处理依赖关系并下载依赖关系的包进行安装)。所以用yum安装,实质上是用RPM安装,所以RPM查询信息的指令都可用。

在Red Hat Enterprise Linux Server release 5.7 (Tikanga)上使用RPM方式安装Percona Xtrabackup 2.4.6时遇到了一些问题,特意总结在此。

如何在Linux下卸载MySQL数据库呢? 下面总结、整理了一下Linux平台下卸载MySQL的方法。 MySQL的安装主要有三种方式:二进制包安装(Using Generic Binaries)、RPM包安装、源码安装。对应不同的安装方式,卸载的步骤有些不同。文章中如有不足或不对的地方,敬请指出或补充!

 

 

 

如果使用RPM安装了一些包,一般来说,RPM默认安装路径如下:

[root@DB-Server tmp]#yum -y install perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL

RPM包安装方式的MySQL卸载

 

 

 

  Directory

Contents of Directory

/etc

一些配置文件的目录,例如/etc/init.d/mysql

 

/usr/bin

一些可执行文件

/usr/lib

一些程序使用的动态函数库

/usr/share/doc

一些基本的软件使用手册与帮助文档

/usr/share/man

一些man page文件

图片 1

1: 检查是否安装了MySQL组件。

 

 

[root@DB-Server init.d]# rpm -qa | grep -i mysql

 

MySQL-devel-5.6.23-1.linux_glibc2.5

 

MySQL-client-5.6.23-1.linux_glibc2.5

 

MySQL-server-5.6.23-1.linux_glibc2.5

 

以MySQL的安装为例,我们使用RPM方式安装了MySQL的两个包,其实rpm有两个参数-l和-c可以帮助我们查看具体的安装路径。

 

图片 2

 

安装相关依赖组件时,遇到conflict with file的错误,如上截图所示,然后安装Percona Xtrabackup 2.4.6是就会遇到下面错误:

如上所示,说明安装了MySQL 5.6.23这个版本的client、server、devel三个组件。

-l 显示软件包中的文件列表

 

 

-c 显示配置文件列表

[root@DB-Server tmp]# rpm -ivh percona-xtrabackup-24-2.4.6-2.el5.x86_64.rpm 

warning: percona-xtrabackup-24-2.4.6-2.el5.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID cd2efd2a

error: Failed dependencies:

        libev.so.4()(64bit) is needed by percona-xtrabackup-24-2.4.6-2.el5.x86_64

        perl(DBD::mysql) is needed by percona-xtrabackup-24-2.4.6-2.el5.x86_64

2: 卸载前关闭MySQL服务

 

 

 

那么我们可以使用“rpm -ql  包名”来查看具体的安装路径。如下所示:

如上所示,既然缺少组件,那么安装libev.x86_64, 如下所示,本地yum源安装libev.so.4失败,只能从网上下载libev-4.15-1.el5.rf.x86_64.rpm,网址为

2.1 方法1

 

 

[root@DB-Server init.d]# service mysql status

 MySQL running (25673)[  OK  ]

[root@DB-Server init.d]# service mysql stop

 Shutting down MySQL..[  OK  ]

[root@DB-Server init.d]# service mysql status

 MySQL is not running[FAILED]

图片 3

[root@DB-Server tmp]# yum -y install libev.x86_64

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Setting up Install Process

No package libev.x86_64 available.

Nothing to do

 

 

[root@DB-Server tmp]# rpm -ivh libev-4.15-1.el5.rf.x86_64.rpm 

warning: libev-4.15-1.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6

Preparing...                ########################################### [100%]

   1:libev                  ########################################### [100%]

[root@DB-Server tmp]# yum list | grep "perl-DBD-MySQL"

perl-DBD-MySQL.x86_64                      3.0007-2.el5                media   

[root@DB-Server tmp]# yum install perl-DBD-MySQL

图片 4

 

 

 

 

安装 perl-DBD-MySQL时,就会遇到大量类似下面错误

2.2 方法2

[root@DB-Server ~]# rpm -qa | grep -i mysql

 

[root@DB-Server init.d]# ./mysql status

 MySQL running (26215)[  OK  ]

[root@DB-Server init.d]# ./mysql stop

 Shutting down MySQL..[  OK  ]

[root@DB-Server init.d]# ./mysql status

 MySQL is not running[FAILED]

[root@DB-Server init.d]# 

MySQL-server-advanced-5.6.20-1.rhel5

 

图片 5

MySQL-client-advanced-5.6.20-1.rhel5

  file /usr/bin/msql2mysql from install of mysql-5.0.77-4.el5_6.6.x86_64 conflicts with file from package MySQL-client-advanced-5.6.20-1.rhel5.x86_64

[root@DB-Server init.d]# chkconfig --list | grep -i mysql

 

mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

 

[root@DB-Server init.d]# 

 

[root@DB-Server ~]# rpm -ql MySQL-client-advanced-5.6.20-1.rhel5

  file /usr/bin/mysql from install of mysql-5.0.77-4.el5_6.6.x86_64 conflicts with file from package MySQL-client-advanced-5.6.20-1.rhel5.x86_64

 

/usr/bin/msql2mysql

  file /usr/bin/mysql_find_rows from install of mysql-5.0.77-4.el5_6.6.x86_64 conflicts with file from package MySQL-client-advanced-5.6.20-1.rhel5.x86_64

3. 收集MySQL对应的文件夹信息

/usr/bin/mysql

  file /usr/bin/mysql_waitpid from install of mysql-5.0.77-4.el5_6.6.x86_64 conflicts with file from package MySQL-client-advanced-5.6.20-1.rhel5.x86_64

[root@DB-Server init.d]# whereis mysql

/usr/bin/mysql_config_editor

  file /usr/bin/mysqlaccess from install of mysql-5.0.77-4.el5_6.6.x86_64 conflicts with file from package MySQL-client-advanced-5.6.20-1.rhel5.x86_64

mysql: /usr/bin/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz

/usr/bin/mysql_find_rows

 

最好实用find命令查看MySQL数据库相关的文件,方便后面彻底删除MySQL。

/usr/bin/mysql_waitpid

 

[root@DB-Server init.d]# find / -name mysql

/etc/rc.d/init.d/mysql

/etc/logrotate.d/mysql

/var/lock/subsys/mysql

/var/lib/mysql

/var/lib/mysql/mysql

/usr/include/mysql

/usr/include/mysql/mysql

/usr/bin/mysql

/usr/share/mysql

/usr/lib64/mysql

/usr/bin/mysqlaccess

遇到这个错误是因为没有安装MySQL-shared-compat组件,安装了MySQL-shared-compat-advanced-5.6.20-1.rhel5.x86_64.rpm后,然后使用yum install perl-DBD-MySQL就不会遇到conflict with file的错误

图片 6

/usr/bin/mysqlaccess.conf

 

 

/usr/bin/mysqladmin

[root@DB-Server tmp]# rpm -qa | grep -i mysql

MySQL-server-advanced-5.6.20-1.rhel5

MySQL-client-advanced-5.6.20-1.rhel5

[root@DB-Server tmp]# rpm -ivh MySQL-shared-compat-advanced-5.6.20-1.rhel5.x86_64.rpm 

Preparing...                ########################################### [100%]

   1:MySQL-shared-compat-adv########################################### [100%]

[root@DB-Server tmp]# yum install perl-DBD-MySQL

[root@DB-Server tmp]# rpm -ivh percona-xtrabackup-24-2.4.6-2.el5.x86_64.rpm 

warning: percona-xtrabackup-24-2.4.6-2.el5.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID cd2efd2a

Preparing...                ########################################### [100%]

   1:percona-xtrabackup-24  ########################################### [100%]

[root@DB-Server tmp]# 

4: 卸载删除MySQL各类组件

/usr/bin/mysqlbinlog

[root@DB-Server init.d]# 

[root@DB-Server init.d]# rpm -ev MySQL-devel-5.6.23-1.linux_glibc2.5

[root@DB-Server init.d]# rpm -ev MySQL-server-5.6.23-1.linux_glibc2.5

You have new mail in /var/spool/mail/root

[root@DB-Server init.d]# rpm -ev MySQL-client-5.6.23-1.linux_glibc2.5

[root@DB-Server init.d]#

/usr/bin/mysqlcheck

图片 7

/usr/bin/mysqldump

 

/usr/bin/mysqlimport

5:删除MySQL对应的文件夹

/usr/bin/mysqlshow

 

/usr/bin/mysqlslap

检查各个MySQL文件夹是否清理删除干净。

/usr/share/man/man1/msql2mysql.1.gz

[root@DB-Server init.d]# whereis mysql

mysql:

[root@DB-Server init.d]# find / -name mysql

/var/lib/mysql

/var/lib/mysql/mysql

/usr/lib64/mysql

[root@DB-Server init.d]# rm -rf /var/lib/mysql

[root@DB-Server init.d]# rm -rf /var/lib/mysql/mysql

[root@DB-Server init.d]# rm -rf /usr/lib64/mysql

[root@DB-Server init.d]# 

/usr/share/man/man1/mysql.1.gz

6:删除mysql用户及用户组

/usr/share/man/man1/mysql_config_editor.1.gz

如果有必要,删除mysql用户以及mysql用户组。

/usr/share/man/man1/mysql_find_rows.1.gz

[root@DB-Server ~]# more /etc/passwd | grep mysql

mysql:x:101:501::/home/mysql:/bin/bash

[root@DB-Server ~]# more /etc/shadow | grep mysql

mysql:!!:16496::::::

[root@DB-Server ~]# more /etc/group | grep mysql

mysql:x:501:

[root@DB-Server ~]# userdel mysql

[root@DB-Server ~]# groupdel mysql

groupdel: group mysql does not exist

[root@DB-Server ~]# 

/usr/share/man/man1/mysql_waitpid.1.gz

 

/usr/share/man/man1/mysqlaccess.1.gz

7:确认MySQL是否卸载删除

/usr/share/man/man1/mysqladmin.1.gz

[root@DB-Server init.d]# rpm -qa | grep -i mysql

/usr/share/man/man1/mysqlbinlog.1.gz

 

/usr/share/man/man1/mysqlcheck.1.gz

二进制包/源码安装方式的MySQL卸载

/usr/share/man/man1/mysqldump.1.gz

如果是采用二进制包安装的MySQL,那么你用下面命令是找不到任何MySQL组件的。所以如果你不知道MySQL的安装方式,千万不要用下面命令来判别是否安装了MySQL

/usr/share/man/man1/mysqlimport.1.gz

[root@DB-Server init.d]# rpm -qa | grep -i mysql

/usr/share/man/man1/mysqlshow.1.gz

 

/usr/share/man/man1/mysqlslap.1.gz

1: 检查MySQL服务并关闭服务进程

 

 

 

首先通过进程查看是否有MySQL的服务的状态, 如下所示,MySQL服务是启动的。

[root@DB-Server tmp]# rpm -ql MySQL-server-advanced-5.6.20-1.rhel5

[root@DB-Server init.d]# ps -ef | grep mysql

root      4752  4302  0 22:55 pts/1    00:00:00 more /etc/init.d/mysql.server

root      7176     1  0 23:23 pts/1    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/DB-Server.localdomain.pid

mysql     7269  7176 15 23:23 pts/1    00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/DB-Server.localdomain.err --pid-file=/usr/local/mysql/data/DB-Server.localdomain.pid

root      7321  4302  0 23:23 pts/1    00:00:00 grep mysql

[root@DB-Server init.d]# /etc/init.d/mysql.server status

MySQL running (7269)[  OK  ]

[root@DB-Server init.d]# /etc/init.d/mysql.server stop

Shutting down MySQL..[  OK  ]

[root@DB-Server init.d]# /etc/init.d/mysql.server status

MySQL is not running[FAILED]

[root@DB-Server init.d]# 

/etc/init.d/mysql

图片 8

/etc/logrotate.d/mysql

 

/etc/my.cnf

2: 查找MySQL的安装目录并彻底删除

/usr/bin/innochecksum

[root@DB-Server init.d]# whereis mysql

 

mysql: /usr/local/mysql

 

[root@DB-Server init.d]# find / -name mysql

 

/var/spool/mail/mysql

 

/usr/local/mysql-5.7.5-m15-linux-glibc2.5-x86_64/include/mysql

 

/usr/local/mysql-5.7.5-m15-linux-glibc2.5-x86_64/bin/mysql

 

/usr/local/mysql-5.7.5-m15-linux-glibc2.5-x86_64/data/mysql

 

/usr/local/mysql

 

/usr/bin/my_print_defaults

图片 9

/usr/bin/myisam_ftdump

[root@DB-Server init.d]# rm -rf /usr/local/mysql-5.7.5-m15-linux-glibc2.5-x86_64/

 

[root@DB-Server init.d]# rm -rf /usr/local/

 

[root@DB-Server init.d]# rm -rf /var/spool/mail/mysql

 

[root@DB-Server init.d]# 

 

/usr/bin/myisamchk

 

/usr/bin/myisamlog

3: 删除一些配置文件

/usr/bin/myisampack

配置文件一般有/etc/my.cnf 或/etc/init.d/mysql.server,视具体安装配置情况而定。

/usr/bin/mysql_convert_table_format

 

/usr/bin/mysql_fix_extensions

4:删除MySQL用户以及用户组

/usr/bin/mysql_install_db

[root@DB-Server ~]# id mysql

 

uid=101(mysql) gid=501(mysql) groups=501(mysql) context=root:system_r:unconfined_t:SystemLow-SystemHigh

 

[root@DB-Server ~]# userdel mysql

/usr/bin/mysql_plugin

/usr/bin/mysql_secure_installation

/usr/bin/mysql_tzinfo_to_sql

/usr/bin/mysql_upgrade

/usr/bin/mysql_zap

/usr/bin/mysqlbug

/usr/bin/mysqld_multi

/usr/bin/mysqld_safe

/usr/bin/mysqldumpslow

/usr/bin/mysqlhotcopy

/usr/bin/mysqltest

.....................................................

 

图片 10

 

 

[root@DB-Server ~]# rpm -qc MySQL-server-advanced-5.6.20-1.rhel5

 

/etc/logrotate.d/mysql

 

/etc/my.cnf

 

[root@DB-Server ~]# 

 

在MySQL的官方文档,你可以看到RPM包所在的安装目录。我们使用rpm -ql 对比验证了一下,基本都OK,但是很奇怪的是,在上面这个版本中,我没有找到/etc/my.cnf,而是/usr/my.cnf

 

MySQL 5.6

Directory

Contents of Directory

/usr/bin

Client programs and scripts

/usr/sbin

The mysqld server

/var/lib/mysql

Log files, databases

/var/lib/mysql-files

Value of secure_file_priv

/usr/share/info

MySQL manual in Info format

/usr/share/man

Unix manual pages

/usr/include/mysql

Include (header) files

/usr/lib/mysql

Libraries

/usr/share/mysql

Miscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation

/usr/share/sql-bench

Benchmarks

 

 

 

MySQL 5.7

Files or Resources

Location

Client programs and scripts

/usr/bin

mysqld server

/usr/sbin

Configuration file

/etc/my.cnf

Data directory

/var/lib/mysql

Error log file

For RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log

For SLES: /var/log/mysql/mysqld.log

Value of secure_file_priv

/var/lib/mysql-files

System V init script

For RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld

For SLES: /etc/init.d/mysql

Systemd service

For RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld

For SLES: mysql

Pid file

/var/run/mysql/mysqld.pid

Socket

/var/lib/mysql/mysql.sock

Keyring directory

/var/lib/mysql-keyring

Unix manual pages

/usr/share/man

Include (header) files

/usr/include/mysql

Libraries

/usr/lib/mysql

Miscellaneous support files (for example, error messages, and character set files)

/usr/share/mysql

 

 

另外一台测试服务器,使用yum安装了mysql-community-server-5.7.18,测试验证发现又是正常。 暂时不清楚这个细节问题。

 

图片 11

 

本文由金沙棋牌发布于操作系统,转载请注明出处:使用rpm安装XtraBackup问题总结,Linux如何查看YUM的

关键词: