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 卸载的全过程,和安装的过程

希望对你有所帮助!

相关推荐
Trouvaille ~7 分钟前
【Linux】线程同步与互斥(三):生产者消费者模型实战
linux·运维·c++·信号量·阻塞队列·生产者消费者模型·环形队列
遇见火星9 分钟前
Linux Screen 命令入门指南
linux·运维·服务器
Doro再努力1 小时前
【Linux操作系统06】深入理解权限掩码与粘滞位
linux·运维·服务器
wdfk_prog1 小时前
[Linux]学习笔记系列 -- [drivers][dma]stm32-dma
linux·笔记·学习
mzhan0171 小时前
[Linux] vdso 32bit vs 64bit
linux·运维·服务器
旖旎夜光1 小时前
Linux(13)(上)
linux·网络
忧郁的橙子.1 小时前
26期_01_Pyhton linux基本命令
linux·运维·服务器
郝学胜-神的一滴1 小时前
深入解析Linux网络编程之bind函数:从基础到实践的艺术
linux·服务器·网络·c++·websocket·程序人生
西京刀客1 小时前
macOS 打出来的 tar 包,Linux 常见告警(tar 包里带了 macOS 的扩展属性(xattr))
linux·运维·macos
mango_mangojuice1 小时前
Linux学习笔记(角色,权限管理)1.21
linux·笔记·学习