【安装】Linux Centos 或 Debian 离线安装指定版本MariaDB

【安装】Linux Centos 或 Debian 离线安装指定版本MariaDB

下载地址

https://mariadb.com/downloads/community/community-server/https://mirrors.aliyun.com/mariadb/yum/https://mariadb.com/downloads/community/community-server/

Download MariaDB Server - MariaDB.org

mariadb-yum安装包下载_开源镜像站-阿里云

  1. 下载安装包

centos

mariadb-11.4.2-rhel-7-x86_64-rpms.tar

复制代码
wget https://dlm.mariadb.com/3827291/MariaDB/mariadb-11.4.2/yum/centos/mariadb-11.4.2-rhel-7-x86_64-rpms.tar

Debian

选择对应的 Debian版本

mariadb-11.4.2-debian-bookworm-amd64-debs.tar

复制代码
wget https://dlm.mariadb.com/3825286/MariaDB/mariadb-11.4.2/repo/debian/mariadb-11.4.2-debian-bookworm-amd64-debs.tar

2.解压

复制代码
tar -xvf mariadb-11.4.2-rhel-7-x86_64-rpms.tar

3.进入该目录

复制代码
cd mariadb-11.4.2-rhel-7-x86_64-rpms/

4.执行 ./setup_repository

复制代码
./setup_repository

5.安装MariaDB

Centos安装命令

复制代码
yum -y install MariaDB-server

debian 安装命令

复制代码
apt install mariadb-server

安装成功

启动服务

复制代码
sudo systemctl start mariadb

配置安全控制程序

复制代码
mariadb-secure-installation

输入当前 root 密码,因为当前密码为空,直接回车

是否设置 root 密码,这里输入 y 表示设置密码,输入2次密码,显示 success 为成功

是否删除匿名用户,选择删除

是否禁止 root 用户远程登录数据库,设置为是

是否删除test数据库,这里为了后面测试选择不删除

是否重载授权表,选择是

重启服务

复制代码
sudo systemctl restart mariadb

停止服务

复制代码
sudo systemctl stop mariadb

默认安装目录

复制代码
/usr/share/mariadb/

准备工作

1.启动服务

2.修改root密码

复制代码
mysqladmin -u root -p password 新密码

刚开始没密码 所以直接两个回车就行

3.修改root外网可以访问

遇到的问题

库没了 只能看到这两个库了

原因是没权限

修改配置文件

/etc/my.cnf.d/server.cnf

复制代码
[mysqld]
skip-grant-tables

然后重启服务

屏蔽密码登录

>mysql -uroot -p

> use mysql;

>create user 'root'@'localhost';

ERROR 1290 (HY000): The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement

报错,输入命令刷新即可

>flush privileges ;

>create user 'root'@'localhost';

赋予所有权限 并且修改root密码为123456

>grant all privileges on *.* to 'root'@'localhost' identified by '123456' with grant option;

>flush privileges ;

相关推荐
Johny_Zhao7 小时前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
chlk1232 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑2 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
碳基沙盒2 天前
OpenClaw 多 Agent 配置实战指南
运维
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash2 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI3 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行4 天前
Linux和window共享文件夹
linux
木心月转码ing4 天前
WSL+Cpp开发环境配置
linux