Connect to an External MSSQL Database
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.
note
At this time, self-hosted Bitwarden instances will support MSSQL 2017, however, the Bitwarden recommended minimum SQL version is Server 2019.
Bitwarden supports and recommends SQL Server 2022 where possible. As mainstream support for Server 2017 ended in October, 2022, depreciation of support for a specific SQL server version will be noted here and in the release notes for a given release if Bitwarden implements features that are not available on a specific version of SQL Server.
To setup your self-hosted instance with an external database:
Create a new MSSQL database.
(Recommended) Create a dedicated DBO for your database.
As an administrator of your Bitwarden server, open the
global.override.env
file in an editor:Bashnano bwdata/env/global.override.env
Edit the
globalSettings__sqlServer__connectionString=
value for the following information:Replace
"Data Source=tcp:mssql,1433";
with your MSSQL server name, for example"Data Source=protocol:server_url,port"
.Replace the
vault
inInitial Catalog=vault
; with your database name.Replace
User ID=sa;
with your DBO User ID.Replace
Password=<default_pw>;
with your DBO password.
Save your changes to
global.override.env
.Start Bitwarden (
./bitwarden.sh start
).
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.
If you need Bitwarden to validate your MSSQL database server's certificate, mount the certificate into your self-hosted Bitwarden server's containers. To do this:
Copy your root CA certificate into
./bwdata/ca-certificates
.Run the
./bitwarden.sh restart
command to apply the certificate to your containers and restart your server.
Suggest changes to this page
How can we improve this page for you?
For technical, billing, and product questions, please contact support