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

希望对你有所帮助!

相关推荐
南川琼语6 分钟前
Linux——共享内存
linux·运维·服务器
风路丞5 小时前
centos-stream-9上安装nvidia驱动和cuda-toolkit
linux·运维·centos
Amelio_Ming6 小时前
linux 内核 static-key机制分析
linux
yl--炼气6 小时前
windows下wsl-ubuntu子系统的位置怎样从C盘转到其他盘
linux·运维·ubuntu
博睿谷IT99_7 小时前
红帽认证 Linux安全 级别
linux·运维·安全
Cv打怪升级7 小时前
ubuntu 常用指令
linux·运维·ubuntu
用手码出世界7 小时前
【Linux】进程池bug、命名管道、systemV共享内存
linux·运维·bug
正点原子8 小时前
【正点原子STM32MP257连载】第二章 ATK-DLMP257B使用前准备 #串口软件 #MobaXterm
linux·stm32·单片机·嵌入式硬件
MobiCetus9 小时前
Linux Kernel 7
linux·运维·服务器·windows·ubuntu·centos·gnu
XDIGAS9 小时前
Dockerfile项目实战-单阶段构建Vue2项目
docker·容器·centos·node.js·vue