【安装】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 ;

相关推荐
chian-ocean19 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=21 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
北京耐用通信1 小时前
航空装配自动化神器Ethercat转profient网关搭配机器人精准控制
运维·机器人·自动化
吃汤圆的抹香鲸1 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
sz66cm2 小时前
Linux基础 -- ARM 32 位架构动态注入代码技术文档
linux·arm开发·架构
Mr.pyZhang4 小时前
Android构建系统 - 04 编译产物
android·linux