centos 系统yum 安装 mariadb

安装很简单 直接执行命令就行了

bash 复制代码
 yum -y install mariadb-server mariadb

但是之前已经在这里安装了mariadb 这个数据库了,现在一直无法启动,那么又重新安装

发现还是无法启动,那肯定是因为没有卸载干净,现在我们就来说说如何将原来的mariadb卸载干净然后再重新安装

第一步:移除相关的安装包,先执行 yum remove mariadb

bash 复制代码
[root@openstack2 my.cnf.d]# yum remove mariadb
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 3:10.1.20-2.el7 will be erased
--> Processing Dependency: mysql(x86-64) for package: 3:mariadb-server-10.1.20-2.el7.x86_64
--> Processing Dependency: mysql-compat-client(x86-64) for package: 3:mariadb-server-10.1.20-2.el7.x86_64
--> Running transaction check
---> Package mariadb-server.x86_64 3:10.1.20-2.el7 will be erased
--> Finished Dependency Resolution

第二步:查询mariadb 相关的数据包,然后删除 rpm -qa | grep 'mariadb'

bash 复制代码
[root@openstack2 my.cnf.d]# rpm -qa | grep 'mariadb'
mariadb-config-10.1.20-2.el7.x86_64
mariadb-libs-10.1.20-2.el7.x86_64
mariadb-common-10.1.20-2.el7.x86_64
mariadb-errmsg-10.1.20-2.el7.x86_64
[root@openstack2 my.cnf.d]# rm -f mariadb-config-10.1.20-2.el7.x86_64
[root@openstack2 my.cnf.d]# rm -f mariadb-libs-10.1.20-2.el7.x86_64
[root@openstack2 my.cnf.d]# rm -f mariadb-common-10.1.20-2.el7.x86_64
[root@openstack2 my.cnf.d]# rm -f mariadb-errmsg-10.1.20-2.el7.x86_64

第三步:删除相关的 /etc/my.cnf 文件 和 /etc/my.cnf.d 文件夹

bash 复制代码
[root@openstack2 my.cnf.d]# rm -f /etc/my.cnf
[root@openstack2 my.cnf.d]# rm -rf /etc/my.cnf.d/

第四步:安装数据库 yum -y install mariadb-server mariadb

bash 复制代码
[root@openstack2 etc]# yum -y install mariadb-server mariadb
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                   | 3.6 kB  00:00:00     
epel                                                                                                                                   | 4.7 kB  00:00:00     
extras                                                                                                                                 | 2.9 kB  00:00:00     
openstack                                                                                                                              | 2.9 kB  00:00:00     
updates                                                                                                                                | 2.9 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 3:10.1.20-2.el7 will be installed
---> Package mariadb-server.x86_64 3:10.1.20-2.el7 will be installed
--> Finished Dependency Resolution

第四步:启动mariadb

systemctl start mariadb

systemctl status mariadb

bash 复制代码
[root@openstack2 etc]# systemctl status mariadb
● mariadb.service - MariaDB 10.1 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2024-08-26 23:40:03 EDT; 12min ago
  Process: 12864 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 12787 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
  Process: 12764 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 12823 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─12823 /usr/libexec/mysqld --basedir=/usr

上面就是mariadb 卸载的全过程,和安装的过程

希望对你有所帮助!

相关推荐
任风雨25 分钟前
附录I Linux命令一览
linux·服务器
黄金旺铺44 分钟前
Linux 命令与运维终极手册(2025 完整版)
linux·运维·服务器
qq_398586541 小时前
小小电脑安装logisim-evolution
linux·proot
oioihoii2 小时前
不止于Linux:百花齐放的开源世界与社区的力量
linux·运维·开源
打不了嗝 ᥬ᭄2 小时前
传输层协议TCP
linux·服务器·网络·c++·tcp/ip
moringlightyn2 小时前
基础开发工具--编译器g++/gcc 自动化构建make/Makefile
linux·运维·笔记·自动化·c·编译器·make/makefile
程序员陆通2 小时前
CentOS/AlmaLinux 9 中 SSH 服务启动失败:OpenSSL 版本不匹配解决
linux·centos·ssh
ZYMFZ2 小时前
HAProxy 简介及配置
linux·负载均衡·haproxy
敲上瘾2 小时前
Linux系统C++开发环境搭建工具(三)—— brpc使用指南
linux·c++·分布式·rpc
李少兄3 小时前
解决 CentOS 8 报错:Failed to download metadata for repo ‘BaseOS‘
linux·运维·centos