diff --git a/README.md b/README.md index 767b416..62c4814 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ This tool supports backing up the following files or directories. - `db.sqlite3` (for SQLite database) - `db.dump` (for PostgreSQL database) +- `db.sql` (for MySQL / MariaDB database) - `config.json` - `rsa_key*` (multiple files) - `attachments` (directory) @@ -493,6 +494,7 @@ We recommend re-downloading the `docker-compose.yml` file, replacing your enviro - [Run as non-root user](docs/run-as-non-root-user.md) - [Multiple remote destinations](docs/multiple-remote-destinations.md) - [Using the PostgreSQL backend](docs/using-the-postgresql-backend.md) +- [Using the MySQL(MariaDB) backend](docs/using-the-mysql-or-mariadb-backend.md)
diff --git a/README_zh.md b/README_zh.md index 3a2d38a..c6fb29c 100644 --- a/README_zh.md +++ b/README_zh.md @@ -33,6 +33,7 @@ - `db.sqlite3` (SQLite 数据库) - `db.dump` (PostgreSQL 数据库) +- `db.sql` (MySQL / MariaDB 数据库) - `config.json` - `rsa_key*` (多个文件) - `attachments` (目录) @@ -490,6 +491,7 @@ docker run --rm -it -e MAIL_SMTP_VARIABLES='' -e MAIL_TO='< - [以非 root 用户运行](docs/run-as-non-root-user.md) - [备份到多个远程目标](docs/multiple-remote-destinations.md) - [使用 PostgreSQL 数据库](docs/using-the-postgresql-backend.md) +- [使用 MySQL(MariaDB) 数据库](docs/using-the-mysql-or-mariadb-backend.md)
diff --git a/docs/using-the-mysql-or-mariadb-backend.md b/docs/using-the-mysql-or-mariadb-backend.md new file mode 100644 index 0000000..4507859 --- /dev/null +++ b/docs/using-the-mysql-or-mariadb-backend.md @@ -0,0 +1,67 @@ +# Using the MySQL(MariaDB) backend + +Now supports MySQL(MariaDB) backend. + +
+ + + +## Environment Variables + +#### DB_TYPE + +Set to `mysql` switch to MySQL(MariaDB) database. + +Default: `sqlite` + +#### MYSQL_HOST + +MySQL(MariaDB) host, **required**. + +#### MYSQL_PORT + +MySQL(MariaDB) port. + +Default: `3306` + +#### MYSQL_DATABASE + +MySQL(MariaDB) database name. + +Default: `vaultwarden` + +#### MYSQL_USERNAME + +MySQL(MariaDB) username. + +Default: `vaultwarden` + +#### MYSQL_PASSWORD + +MySQL(MariaDB) password, **required**. + +
+ + + +## Backup + +Specify the above environment variables to switch to the MySQL(MariaDB) database. + +
+ + + +## Restore + +When restoring, also specify the above environment variables to switch to the MySQL(MariaDB) database. + +1. Ensure that the database is accessible. + +Perhaps you will use the `docker-compose up -d [services name]` command to start the database separately. + +2. Verify that the `MYSQL_HOST` you are using is accessible to. + +If your database is running in docker-compose, you need to find the corresponding network name via `docker network ls` and add `--network=[name]` to the restore command to specify the network name. + +3. Restore and restart the container.