SQL Server on linux unable to export to bacpac I'm trying to export my database to a .bacpac file.  I get the following error:

(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)


The command I'm using is:

/opt/mssql/bin/sqlpackage /action:Export /SourceServerName:localhost /SourceDatabaseName:MyDB /targetfile:'/media/jake/1F171B4C75D06418/MyDB.bacpac'


The database I'm trying to back up is on a different ssd than my mssql installation.  I don't know if that makes a difference.

I've been googling around for how to fix this and most people using windows had their similar problem solved by making sure that various windows services were running and starting them if they weren't.  But I'm not sure how to check for the same thing in linux, but I think all the services I need are currently running because I can connect to the database via sqlcmd as well as through JetBrains' DataGrip application.  So I know that a connection is possible.  I just don't know why sqlpackage is having trouble connecting...

I've also tried variations of this command on the SourceServerName parameter:

/opt/mssql/bin/sqlpackage /action:Export /SourceServerName:tcp:localhost,1433 /SourceDatabaseName:MyDB /targetfile:'/media/jake/1F171B4C75D06418/MyDB.bacpac'


And the error is slightly different:

(provider: TCP Provider, error: 0 - No such host is known.)
According to the official documentation for SqlPackage on 2017 CTP 2.1, the command to export data and schema is as follows:

/opt/mssql/bin/sqlpackage /a:Export /ssn:tcp:&lt;your_server&gt; /sdn:&lt;your_database&gt; /su:&lt;username&gt; /sp:&lt;password&gt; /tf:&lt;/path/to/your/file.bacpac&gt;


Looking at your command, it appears you're missing credentials, so I'd give this a try (I've shortened the other parameters as well, and removed the TCP port):

/opt/mssql/bin/sqlpackage /a:Export /ssn:tcp:localhost /sdn:MyDB /su:&lt;user&gt; /sp:&lt;password&gt; /tf:'/media/jake/1F171B4C75D06418/MyDB.bacpac'