wrong migrate sqlite to mysql doc #1453

Closed
opened 2025-10-09 17:15:42 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @scofieldpeng on GitHub.

Subject of the issue

wrong doc in migrate from sqlite to mysql

Deployment environment

  • bitwarden_rs version: 1.19.0
  • Install method: docker

  • Clients used:

  • Reverse proxy and version:

  • MySQL/MariaDB or PostgreSQL version:

  • Other relevant details:

Steps to reproduce

  1. pull the 1.19.0 docker image from docker hub by docker pull bitwarden_rs/server:1.19.0 (by the way, the `bitwarden_rs/server:1.19.0-alpine don't support mysql)
  2. start docker image by docker run command to let bitwarden create the latest tables to mysql
  3. stop docker container
  4. run sqlite3 db.sqlite3 .dump | grep "^INSERT INTO" | grep -v "__diesel_schema_migrations" > sqlitedump.sql ; echo -ne "SET FOREIGN_KEY_CHECKS=0;\n$(cat sqlitedump.sql)" > mysqldump.sql in bitwarden data dir.
  5. when import sql to mysql, I sure occur this problem error (1064): Syntax error near '"users" VALUES('9b5c2d13-8c4f-47e9-bd94-f0d7036ff581'*********)
  6. follow the doc run the command in bash sed -i 's#\"#\#g' mysqldump.sql, in fact, this command will not run correctly, I search the right command in issue, and run the correct command sed -i s#\"#\#g mysqldump.sql
  7. start container again
  8. bitwarden start but the all passwords are not shown

the problem is the sed command, it want to change

INSERT INTO "users" VALUES('9b5c2d13-8c4f-47e9-bd94-f0d7036ff581',******)

to

INSERT INTO users VALUES('9b5c2d13-8c4f-47e9-bd94-f0d7036ff581',******)

but it also remove the all " in field data in table cipher, so the json string broken.

help this issue can help those people want to migrate from sqlite to mysql :-)

Expected behaviour

Actual behaviour

Troubleshooting data

Originally created by @scofieldpeng on GitHub. <!-- # ### NOTE: Please update to the latest version of bitwarden_rs before reporting an issue! This saves you and us a lot of time and troubleshooting. See: * https://github.com/dani-garcia/bitwarden_rs/issues/1180 * https://github.com/dani-garcia/bitwarden_rs/wiki/Updating-the-bitwarden-image # ### --> <!-- Please fill out the following template to make solving your problem easier and faster for us. This is only a guideline. If you think that parts are unnecessary for your issue, feel free to remove them. Remember to hide/redact personal or confidential information, such as passwords, IP addresses, and DNS names as appropriate. --> ### Subject of the issue <!-- Describe your issue here. --> wrong [doc](https://github.com/dani-garcia/bitwarden_rs/wiki/Using-the-MariaDB-%28MySQL%29-Backend) in migrate from sqlite to mysql ### Deployment environment <!-- ========================================================================================= Preferably, use the `Generate Support String` button on the admin page's Diagnostics tab. That will auto-generate most of the info requested in this section. ========================================================================================= --> <!-- The version number, obtained from the logs (at startup) or the admin diagnostics page --> <!-- This is NOT the version number shown on the web vault, which is versioned separately from bitwarden_rs --> <!-- Remember to check if your issue exists on the latest version first! --> * bitwarden_rs version: 1.19.0 <!-- How the server was installed: Docker image, OS package, built from source, etc. --> * Install method: docker * Clients used: <!-- web vault, desktop, Android, iOS, etc. (if applicable) --> * Reverse proxy and version: <!-- if applicable --> * MySQL/MariaDB or PostgreSQL version: <!-- if applicable --> * Other relevant details: ### Steps to reproduce <!-- Tell us how to reproduce this issue. What parameters did you set (differently from the defaults) and how did you start bitwarden_rs? --> 1. pull the 1.19.0 docker image from docker hub by `docker pull bitwarden_rs/server:1.19.0` (by the way, the `bitwarden_rs/server:1.19.0-alpine don't support mysql) 2. start docker image by `docker run command to let bitwarden create the latest tables to mysql` 3. stop docker container 4. run `sqlite3 db.sqlite3 .dump | grep "^INSERT INTO" | grep -v "__diesel_schema_migrations" > sqlitedump.sql ; echo -ne "SET FOREIGN_KEY_CHECKS=0;\n$(cat sqlitedump.sql)" > mysqldump.sql` in bitwarden data dir. 5. when import sql to mysql, I sure occur this problem `error (1064): Syntax error near '"users" VALUES('9b5c2d13-8c4f-47e9-bd94-f0d7036ff581'*********)` 6. follow the [doc](https://github.com/dani-garcia/bitwarden_rs/wiki/Using-the-MariaDB-%28MySQL%29-Backend) run the command in bash `sed -i 's#\"#\#g' mysqldump.sql`, in fact, this command will not run correctly, I search the right command in [issue](https://github.com/dani-garcia/bitwarden_rs/issues/984), and run the correct command `sed -i s#\"#\#g mysqldump.sql` 7. start container again 8. bitwarden start but the all passwords are not shown the problem is the sed command, it want to change ```sql INSERT INTO "users" VALUES('9b5c2d13-8c4f-47e9-bd94-f0d7036ff581',******) ``` to ```sql INSERT INTO users VALUES('9b5c2d13-8c4f-47e9-bd94-f0d7036ff581',******) ``` but it also remove the all `"` in field `data` in table `cipher`, so the json string broken. help this issue can help those people want to migrate from sqlite to mysql :-) ### Expected behaviour <!-- Tell us what you expected to happen --> ### Actual behaviour <!-- Tell us what actually happened --> ### Troubleshooting data <!-- Share any log files, screenshots, or other relevant troubleshooting data -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#1453