1
头图
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 (50k+star) address: https://github.com/macrozheng/mall

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 the 设置->成员 function;

  • 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

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

  • After entering the database connection information and selecting 环境 , 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, open SQL编辑器 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 变更Schema function 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 up and requires manual review, the changes will be directly executed. You can set manual review through 环境 .

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

https://github.com/bytebase/bytebase


macrozheng
1.1k 声望1.3k 粉丝