安装方式:
cookieY/Yearning: 🐳 A most popular sql audit platform for mysql (github.com)
对数据库的一系列后台操作
手动安装:
## 初始化数据库 ./Yearning install ## 启动 ./Yearning run ## 帮助 ./Yearning --help
这里有俩种方式:
1、docker容器里面安装mql(官方)
## 初始化数据库 docker run --rm -it -p8000:8000 -e SECRET_KEY=$SECRET_KEY -e MYSQL_USER=$MYSQL_USER -e MYSQL_ADDR=$MYSQL_ADDR -e MYSQL_PASSWORD=$MYSQL_PASSWORD -e MYSQL_DB=$Yearning_DB yeelabs/yearning "/opt/Yearning install" ## 必须在启动容器中初始化数据库 docker run -d -it -p8000:8000 -e SECRET_KEY=$SECRET_KEY -e MYSQL_USER=$MYSQL_USER -e MYSQL_ADDR=$MYSQL_ADDR -e MYSQL_PASSWORD=$MYSQL_PASSWORD -e MYSQL_DB=$Yearning_DB yeelabs/yearning
自己:
先拉取mysql镜像,构建容器,然后运行容器,映射本机访问端口,3306
docker pull mysql:5.7 docker run -itd --name mysql -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 mysql:5.7
这是最新版
这个是老版本稳定版3.1.0的
启动之前需要修改一下配置文件 [root@ruoyi Yearning]# vim conf.toml [Mysql] Db = "yearning" Host = "127.0.0.1" --这个是本机mysql,写的是本机的IP,容器的话,需要写127.0.0.2 Port = "3306" Password = "123456" --数据库的密码 User = "root" --登录的用户 [General] SecretKey = "dbcjqheupqjsuwsm" Hours = 4 [Oidc] Enable = false ClientId = "yearning" ClientSecret = "fefehelj23jlj22f3jfjdfd" Scope = "openid profile" AuthUrl = "https://keycloak.xxx.ca/auth/realms/master/protocol/openid-connect/auth" TokenUrl = "https://keycloak.xxx.ca/auth/realms/master/protocol/openid-connect/token" UserUrl = "https://keycloak.xxx.ca/auth/realms/master/protocol/openid-connect/userinfo" RedirectUrL = "http://127.0.0.1:8000/oidc/_token-login" UserNameKey = "preferred_username" RealNameKey = "name" EmailKey = "email" SessionKey = "session_state"
#启动命令 [root@ruoyi ~]# ls RuoYi-Vue-jenkins anaconda-ks.cfg prometheus-2.45.0.linux-amd64 ruoyi-project-compose.tar.gz Yearning grafana-enterprise-10.0.0-1.x86_64.rpm prometheus-2.45.0.linux-amd64.tar.gz Yearning-v3.1.0-linux-amd64.zip mysqld_exporter-0.15.0.linux-amd64 redis_exporter-v1.53.0.linux-amd64 a.sh mysqld_exporter-0.15.0.linux-amd64.tar.gz redis_exporter-v1.53.0.linux-amd64.tar.gz [root@ruoyi ~]# cd Yearning [root@ruoyi Yearning]# ls README.md Yearning conf.toml docker migrate [root@ruoyi Yearning]# ./Yearning run 检查更新....... 数据已更新! 2024/08/03 12:21:10 /Users/henryyee/PersonalProjects/Yearning-go/src/service/yearning.go:62 record not found [4.313ms] [rows:0] SELECT * FROM `core_global_configurations` ORDER BY `core_global_configurations`.`id` LIMIT 1 __ __ _ \/ /_________ __ /_ _ \ _ \ _ / / __/ __/ /_/ \___/\___/ yee v0.3.5 -----Easier and Faster----- Creator: Henry Yee
1、上传代码包
2、创建数据库或数据库容器,创建库,注意库要配置utf8字符集
create database yearning default charset 'utf8';
3、修改配置文件
库名如果不同需要修改
密码需要修改
4、./Yearning install 安装
5、运行程序
./Yearning run
6、访问
端口:8000
账号:admin
密码:Yearning_admin
7、操作流程
1、创建用户->2、将用户加入到权限组->3、数据源(需要操作的数据库)->配置权限组,将数据源加入到权限组->登录到不同的用户测试流程