Question

Background

I'm having to connect to a customer's Microsoft SQL Server. I generally don't need to do much in databases besides your average SQL, so using the database features in IntelliJ IDEA have so far been more than sufficient for various PostgreSQL and Orcacle databases. In this case though I was given a heads-up that I will have to change my password first, and when I use IDEA to connect with the credentials I received it does indeed reject them and gives me an error message saying I need to change my password. I was also told to use SQL Server Management Studio (SSMS) to do so.

Problem

SSMS is only for Windows, I'm running a Mac. The SSMS download page refers to Azure Data Studio for use on a different OS. An initial try of the latter did not let me change the password though. Even if I eventually find a way to do it, is there really no other easier way to do this that doesn't involve installing another full-blown db tool that I have no intention of using in the long run? Or worst case: buy a windows computer for the sole purpose of installing SSMS so I can change a password? Surely there must be a bunch of Mac- or Linux-using DBA's that know of a simple command-line tool or alike that allows them to change their password initially on a Microsoft SQL Server, after which they just use their favorite db management tool to access it?

Edit: Note on "duplicate"

I disagree that this is a duplicate of Handle expired SQL login's passwords in SQL Server because:

  • That question involves an expired password, while I was never able to log in in the first place, nor able to run any sort of SQL prior to logging in
  • That question involves someone already using SSMS, whereas I've specifically pointed out I cannot use it and I'm asking for an alternative

Additional clarification

  • When I said customer, I meant a client that has data that I need to pull. I do not have any sort of admin access to the VM or SQL Server beyond the credentials I was provided
  • The error I'm getting is not a notification while I'm logged in. It's an error preventing me from even connecting, so I cannot run any other SQL or commands whatsoever
Was it helpful?

Solution

Use SQLCMD for MacOS with the -z parameter for this.

OTHER TIPS

mssql-cli is a command-line tool, available for Mac, Linux and Windows. See https://github.com/dbcli/mssql-cli/tree/master/doc/installation.

It isn't clear, however, if you can't login in the first place. If you can, then just change the password using ALTER LOGIN. If you can't, then you rely on the tool in question to (using any of the SQL Server APIs) to allow you to set a new password. SQLCMD (another command line tool, Win lony) for instance has command-line options for this. mssql-cli doesn't seem to have such options, at this point in time.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top