2.2 KiB
layout, title, categories, featured, popular, tags, order, description
| layout | title | categories | featured | popular | tags | order | description | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| article | Connect to an External MSSQL Database |
|
false | false |
|
13 | This article explains how to connect your self-hosted Bitwarden server to an external MSSQL database instead of the included container. |
By default, self-hosted instances of Bitwarden will use a Microsoft SQL Server (MSSQL) database created as a normal part of installation setup, however you configure Bitwarden to use an external MSSQL database.
{% callout info %} Currently, self-hosted installations of Bitwarden support only MSSQL databases. Stay tuned for future updates on this topic. {% endcallout %}
To setup your self-hosted instance with an external database:
-
Create a new MSSQL database named
vault.{% callout warning %}You must use
vaultas your database name. A different database name will cause migration to fail.{% endcallout %} -
(Recommended) Create a dedicated DBO for your
vaultdatabase. -
As an administrator of your Bitwarden server, open the
global.override.envfile in an editor:nano bwdata/env/global.override.env -
Edit the
globalSettings__sqlServer__connectionString=value for the following information.- Replace
"Data Source=tcp:mssql,1443";with your MSSQL Server name, for example"Data Source=protocol:server_url,port". - Replace
User ID=sa;with your DBO User ID. - Replace
Password=<default_pw>;with your DBO password.
- Replace
-
Save your changes to
global.override.env. -
Start Bitwarden (
./bitwarden.sh start).
{% comment %}
6. Run ./bitwarden.sh updatedb to migrate the database schema.
{% callout success %}updatedb does not migrate data, it only migrates the database schema. To move existing data to the new database, restore a backup from ./bwdata/mssql/backups.{% endcallout %}
{% endcomment %}
Once the above steps are complete, you can test the connection by creating a new user through the Web Vault and querying the external vault database for creation of the new user.