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

希望对你有所帮助!

相关推荐
RisunJan14 小时前
Linux命令-lpq(查看打印队列状态)
linux·运维·服务器
山君爱摸鱼14 小时前
Linux-服务进程
linux·运维·服务器
阿乐艾官14 小时前
【linux文件系统重要目录及命令解释】
linux·运维·服务器
blueSatchel14 小时前
U-Boot启动后做的事情
linux·u-boot
senijusene14 小时前
Linux软件编程: Linux 操作系统基础与shell脚本
linux·运维·chrome
予枫的编程笔记15 小时前
【Linux进阶篇】Linux后台运行避坑指南:nohup、& 用法及Systemd守护进程实操
linux·进程管理·linux运维·nohup·systemctl·ps命令·kill命令
code monkey.15 小时前
【Linux之旅】Linux 进程间通信(IPC)全解析:从管道到共享内存,吃透进程协作核心
linux·c++·ipc
匆匆那年96715 小时前
llamafactory推理消除模型的随机性
linux·服务器·学习·ubuntu
好好学习天天向上~~15 小时前
5_Linux学习总结_vim
linux·学习·vim
Coder个人博客20 小时前
Linux6.19-ARM64 mm mmu子模块深入分析
大数据·linux·车载系统·系统架构·系统安全·鸿蒙系统