centos && redhat 安装mysql数据库

时间:2021-11-15 17:08:33

centos && redhat 安装mysql数据库

直接安装mysql会与centos默认的mariadb-libs冲突,需要先卸载再安装

[root@zhuqingping mysql]# rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.18-1.el7.x86_64
mysql-community-common(x86-64) = 5.7.18-1.el7 is needed by mysql-community-server-5.7.18-1.el7.x86_64
[root@zhuqingping mysql]# rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
file /usr/share/mysql/danish/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
file /usr/share/mysql/dutch/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
file /usr/share/mysql/english/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
file /usr/share/mysql/estonian/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
file /usr/share/mysql/french/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
file /usr/share/mysql/german/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
file /usr/share/mysql/greek/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64

直接卸载会存在软件包的依赖关系

[root@zhuqingping mysql]# rpm -e mariadb-libs-1:5.5.50-1.el7_2.x86_64
error: Failed dependencies:
libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64

选择在卸载的时候忽略依赖关系

[root@zhuqingping mysql]# rpm -e mariadb-libs-1:5.5.50-1.el7_2.x86_64q
[root@zhuqingping mysql]# rpm --help | grep deps
--nodeps don't verify package dependencies
--nodeps do not verify package dependencies
[root@zhuqingping mysql]# rpm --nodeps -e mariadb-libs-1:5.5.50-1.el7_2.x86_64
[root@zhuqingping mysql]# rpm -qa | grep postfix-2
postfix-2.10.1-6.el7.x86_64

安装mysql相关软件包

[root@zhuqingping mysql]# rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-5.7.18-1.e###
############################## [100%]
[root@zhuqingping mysql]# rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-5.7.18-1.el7###
############################## [100%]
[root@zhuqingping mysql]# rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-5.7.18-1.e###
############################## [100%]
[root@zhuqingping mysql]# rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.18-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-5.7.18-1.e###
############################## [100%]

安装完成