[SOLVED] Visual Studio Code mssql extention: SQL Server (mssql) – Unable to connect to server


I’m trying for the first time to get my project to run in Visual Studio Code. This includes a MySQL database. So I’ve installed the SQL Server (mssql) extension version 1.7.1. I follow the instructions here: https://docs.microsoft.com/en-us/sql/visual-studio-code/sql-server-develop-use-vscode?view=sql-server-ver15

I get to the section “Connect to SQL Server” and enter:

  • servername: localhost
  • db name: c3
  • Authentication type: Integrated

At the end of the section it should connect with the server but instead I get two errors:

mssql: Error “Unable to connect using the connection information
provided. Retry profile creation?”

mssql: Error 2: A network-related or instance-specific error occurred
while establishing a connection to SQL Server. The server was not
found or was not accessible. Verify that the instance name is correct
and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 – Could not open a
connection to SQL Server)

Does anyone see what is going wrong here?
I’ve re-installed the extension but with the same result.


A MySQL db and Microsoft SQL Server db are two different things.

It seems that there’s no SQL Server installed? You might install the free SQL Server Express Version, create the database in there and then connect from Visual Studio Code.

You have to install the database server yourself as VS Code is just a client. You might also use somekind of hosted offers (many webhosters offer a mysql server with self service installation, or use a cloud based database server). Yout can also use a local database (e.g. SqlLite) which is file based and doesn’t need a special installation.

Answered By – Peter Schneider

Answer Checked By – David Marino (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *