Self-built database visualization platform in 5 minutes, online database management is also very convenient!

As programmers, we often use clients to manage databases, but rarely use online services that manage databases. Today, I would like to recommend an open source tool Bytebase that can visually manage databases online. It not only manages databases conveniently, but also supports SQL auditing and backup and recovery. In short, the functions are very powerful!

SpringBoot actual e-commerce project mall (60k+star) address: github.com/macrozheng/…

Introduction to Bytebase

Bytebase is a database change management tool for developers and currently has 3.6K+ Stars on Github.

Its main features are as follows:

  • SQL Audit: With a one-stop SQL audit panel, you can visually see all the change records of the database.
  • SQL suggestion: It can automatically check the SQL statement specification, and additionally provide GitHub Action and API access methods.
  • SQL Editor: You can manage and view database tables online, and support automatic syntax prompts.
  • GitOps Workflow: Supports integration of GitHub and GitLab, using GitOps workflow for database changes.
  • Backup and recovery: Support automatic database backup and data recovery.

The following is the effect of using Bytebase to operate the database, and the prompts are quite complete.

Install

First of all, we will install Bytebase under Linux. It is undoubtedly the most convenient to use Docker to install.

  • Since ByteBase supports MySQL8 well, it is recommended to install MySQL8 here. First download the Docker image of MySQL8;
docker pull mysql:8
复制代码
  • Then use the following command to run the MySQL8 container;
docker run -p 3506:3306 --name mysql8 \
-v /mydata/mysql8/mysql-files:/var/lib/mysql-files \
-v /mydata/mysql8/conf:/etc/mysql \
-v /mydata/mysql8/log:/var/log/mysql \
-v /mydata/mysql8/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:8
复制代码
  • Then use the following command to download the Docker image of Bytebase
docker pull bytebase/bytebase:1.3.1
复制代码
  • After the download is successful, use the following command to run the ByteBase container;
docker run --init \
  --name bytebase \
  --restart always \
  --add-host host.docker.internal:192.168.3.105 \
  --publish 5678:5678 \
  --health-cmd "curl --fail http://localhost:5678/healthz || exit 1" \
  --health-interval 5m \
  --health-timeout 60s \
  --volume /mydata/bytebase/data:/var/opt/bytebase \
  -d bytebase/bytebase:1.3.1 \
  --data /var/opt/bytebase \
  --host http://localhost \
  --port 5678
复制代码
  • After successful operation, the server will display the following information;

use

Bytebase not only supports online database management, but also supports a series of database operation and maintenance operations. Let's introduce its common functions.

member

  • We generally do not directly use the administrator account to operate Bytebase, we can 设置->成员add members through functions;

  • Then click the member avatar, edit the member information to set the password, and switch to the ordinary account after the setting is completed.

surroundings

Bytebase's environment function can be used to distinguish instances in different environments, such as test environments and living environments, and can be used to set whether database changes require manual review and automatic database backup strategies.

example

  • When we configure the environment, we can 实例configure the database instance in the function;

  • After entering the database connection information and selecting it 环境, the database instance is successfully configured;

  • When viewing the instance details, you can see the database in the instance;

  • Click the database name to view all table information in the database.

project

  • If we want to use SQL statements to manage the database in Bytebase, we also need to create 项目;

  • After the creation is complete, transfer the database to the project;

  • After this series of operations, you can manage the database and open SQL编辑器it for database management operations.

database

database management

Here is a demonstration of using the SQL editor to operate the database, and the prompts are quite complete.

Database changes

  • If we want to make database changes, we need to select the 变更Schemafunction in the project;

  • Then enter the SQL script we need to change, a product table is created here, the reviewer is specified, and the change can be submitted by clicking Create;

  • Here, because the test environment is not set and requires manual review, the changes will be directly executed, and 环境manual review can be set.

Backup and restore

In the database function, we can also implement automatic and manual backup and data recovery operations.

Summarize

Bytebase is indeed a practical database management and change tool, which allows us to easily manage the database without a client, and its SQL auditing function can prevent developers from mishandling the database.

project address

github.com/bytebase/by…

Guess you like

Origin juejin.im/post/7143045788510191652