mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-02-05 00:29:40 +03:00
Restore database #1138
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gkl1368 on GitHub (Oct 25, 2021).
Today I backup the database from the lastest test docker image, and restore the sql file to other docker. But it always show
the username and password is not correct in the web ui.
And I found it is many errors as below when I restore sql file. Please help.
Warning (Code 150): Create table
vaultwarden.folderswith foreign keyfolders_ibfk_1constraint failed. Field type or character set for column 'user_uuid' does not mach referenced column 'uuid'.Error (Code 1005): Can't create table
vaultwarden.folders(errno: 150 "Foreign key constraint is incorrectly formed")Warning (Code 1215): Cannot add foreign key constraint for
foldersERROR 1146 (42S02) at line 291: Table 'vaultwarden.folders' doesn't exist
ERROR 1146 (42S02) at line 292: Table 'vaultwarden.folders' doesn't exist
ERROR 1146 (42S02) at line 293: Table 'vaultwarden.folders' doesn't exist
ERROR 1146 (42S02) at line 294: Table 'vaultwarden.folders' doesn't exist
ERROR 1005 (HY000) at line 353: Can't create table
vaultwarden.org_policies(errno: 150 "Foreign key constraint is incorrectly formed")Warning (Code 150): Create table
vaultwarden.org_policieswith foreign keyorg_policies_ibfk_1constraint failed. Field type or character set for column 'org_uuid' does not mach referenced column 'uuid'.Error (Code 1005): Can't create table
vaultwarden.org_policies(errno: 150 "Foreign key constraint is incorrectly formed")Warning (Code 1215): Cannot add foreign key constraint for
org_policiesERROR 1146 (42S02) at line 369: Table 'vaultwarden.org_policies' doesn't exist
ERROR 1146 (42S02) at line 370: Table 'vaultwarden.org_policies' doesn't exist
ERROR 1146 (42S02) at line 371: Table 'vaultwarden.org_policies' doesn't exist
ERROR 1005 (HY000) at line 381: Can't create table
vaultwarden.organizations(errno: 150 "Foreign key constraint is incorrectly formed")Error (Code 1005): Can't create table
vaultwarden.organizations(errno: 150 "Foreign key constraint is incorrectly formed")Warning (Code 1215): Cannot add foreign key constraint for
organizationsERROR 1146 (42S02) at line 395: Table 'vaultwarden.organizations' doesn't exist
ERROR 1146 (42S02) at line 396: Table 'vaultwarden.organizations' doesn't exist
ERROR 1146 (42S02) at line 397: Table 'vaultwarden.organizations' doesn't exist
ERROR 1146 (42S02) at line 398: Table 'vaultwarden.organizations' doesn't exist
ERROR 1005 (HY000) at line 408: Can't create table
vaultwarden.sends(errno: 150 "Foreign key constraint is incorrectly formed")Warning (Code 150): Create table
vaultwarden.sendswith foreign keysends_ibfk_1constraint failed. Field type or character set for column 'user_uuid' does not mach referenced column 'uuid'.@gkl1368 commented on GitHub (Oct 25, 2021):
And I have try add SET FOREIGN_KEY_CHECKS=OFF at top of sql file, and then the import has no errors. I have see the org and user in the admin page. And all item is right. But I can't login the webui and all client, It shows vaultwarden::api::identity][ERROR] Username or password is incorrect. Try again.
Your environment (Generated via diagnostics page)
Config (Generated via diagnostics page)
Show Running Config
Environment settings which are overridden: DOMAIN, SIGNUPS_ALLOWED, INVITATIONS_ALLOWED, ADMIN_TOKEN
@topscoder commented on GitHub (Oct 25, 2021):
I was fighting with some sort of issue just yet. In my case:
/data/.envfile was gone.envfile again, pasted the contents of.env.templatefrom this repo and restarted server.Et voila 🥳
Some exact log messages for future searches:
[vaultwarden::api::identity][ERROR] Username or password is incorrect. Try again.[INFO] No .env file found.[panic][ERROR] thread 'main' panicked at 'Failed to turn on WAL: DatabaseError(__Unknown, "unable to open database file")'@gkl1368 commented on GitHub (Oct 25, 2021):
mylog is
vaultwarden | [2021-10-25 12:30:57.036][vaultwarden::api::identity][ERROR] Username or password is incorrect. Try again. IP: . Username:.
Vaultwarden | [2021-10-25 12:30:57.037][response][INFO] POST /identity/connect/token (login) => 400 Bad Request
All user collections and org is right.

@avoidik commented on GitHub (Oct 26, 2021):
same, all of a sudden getting invalid master password error for a perfectly valid master password on the latest vaultwarden install for new logins, while existing connections are fine (I now afraid to logout on mobile to not lose db)
@BlackDex commented on GitHub (Oct 26, 2021):
If using MySQL then there could be an issue with the charset and collation, see #1559 .
If using Sqlite and you get a WAL error after restoring the file from a backup, then it could be the backup is faulty, you should never just copy the file while it is in use. This could break the database, and thus could break your login.
@gkl1368 commented on GitHub (Oct 26, 2021):
I use MySQL,and SET FOREIGN_KEY_CHECKS=OFF before restore old MySQL backup, at this step, it's no error. I can see orgs,users and collections in admin page. But I can't login with all clients include Web.
@gkl1368 commented on GitHub (Oct 26, 2021):
I will try change to old docker image, It also don't work when use old image.
@gkl1368 commented on GitHub (Oct 27, 2021):
I have restore a backup json file to new instance. It's worked good.