树莓派安装mariadb & redis

安装软件

sudo apt install mariadb-server mariadb-client

sudo apt install redis

二. 配置

1, mariadb 配置

配置远程访问

maridb configuration:

sudo mysql_secure_installation # 设置root密码

vim.tiny mariadb.conf.d/50-server.cnf # 设置去除本地绑定

#bind-address = 127.0.0.1

#允许root用户远程访问

mysql -u root -p

grant all privileges on . to root@"%" identified by "my_password" with grant option;

flush privileges;

重启mysql(mariadb)服务

sudo service mysql restart # 如果是mysql则为sudo service mysqld restart

使用Navicat 工具测试成功;

创建一个用户, 专门用于go_gin_api 访问 go_gin_api/go_gin_api

CREATE USER 'go_gin_api'@'%' IDENTIFIED BY 'go_gin_api'; #%代表着不限制ip

flush privileges;

root用户创建新的数据库, ps: 如果有sql 可以使用指令 mysql -u root -p < yourSQL.sql

SET @s = IF(version() < 8 OR (version() LIKE '%MariaDB%' AND version() < 10.3),

'SET GLOBAL innodb_file_per_table = ON,

innodb_file_format = Barracuda,

innodb_large_prefix = ON;',

'SET GLOBAL innodb_file_per_table = ON;');

PREPARE stmt1 FROM @s;

EXECUTE stmt1;

DROP DATABASE IF EXISTS go_gin_api;

CREATE DATABASE IF NOT EXISTS go_gin_api CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

将数据库的增删改查权限给到go_gin_api

#grant select,delete,insert,update on go_gin_api.* to go_gin_api@'%';

GRANT ALL ON go_gin_api.* TO 'go_gin_api'@'%'; # 授权:所有权限

#REVOKE ALL ON go_gin_api.* TO 'go_gin_api'@'%'; # 撤销:

flush privileges;

  1. redis 配置
    vim.tiny /etc/redis/redis.conf

开启远程访问

#bind 127.0.0.1 ::1

关闭保护模式

protected-mode no # yes->no

开启密码

requirepass my_password

使用Another Redis Desktop Manager 客户端工具打开连接成功

相关推荐
薛定谔的算法5 小时前
phoneGPT:构建专业领域的检索增强型智能问答系统
前端·数据库·后端
Databend6 小时前
Databend 亮相 RustChinaConf 2025,分享基于 Rust 构建商业化数仓平台的探索
数据库
得物技术7 小时前
破解gh-ost变更导致MySQL表膨胀之谜|得物技术
数据库·后端·mysql
Raymond运维12 小时前
MariaDB源码编译安装(二)
运维·数据库·mariadb
沢田纲吉12 小时前
🗄️ MySQL 表操作全面指南
数据库·后端·mysql
Seven9713 小时前
剑指offer-31、整数中1出现的次数
redis
RestCloud1 天前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud1 天前
为什么说零代码 ETL 是未来趋势?
数据库·api
ClouGence1 天前
CloudCanal + Paimon + SelectDB 从 0 到 1 构建实时湖仓
数据库
DemonAvenger2 天前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化