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.


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

2 Answers 2


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

  • 1
    I used this with the -z parameter and it was exactly the alternative I was looking for. After changing the password I was able to use my preferred db querying tool and I didn't have to install SSMS, Azure Data Studio or buy Windows. Thank you for not disregarding my question as a duplicate! Commented Jun 2, 2020 at 16:19
  • 2023 and seems the -z parameter is not supported or a bug in version 1.1.0? bash (dev_env) gonluisr@gonluisr-hp-zbook-15-g3:~$ sqlcmd -z sqlcmd: error: unknown flag -z, did you mean one of "-c", "-C", "-d", "-E", "-U", "-i", "-o", "-q", "-Q", "-S", "-X", "-G", "-x", "-v", "-a", "-l", "-H", "-K", "-N", "-b", "-V", "-m", "-F", "-r", "-h", "-u", "-s", "-w", "-W", "-M", "-P", "-?"? Commented Jun 13, 2023 at 20:43

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.

  • I wasn't able to login in the first place, my apologies for not mentioning that specifically in my post. I've clarified it, thank you for mentioning it! Commented Jun 2, 2020 at 15:36
  • You could try mssql-cli and how it reacts. Perhaps it catches the return code that means (couldn't login, you need a new password), and allow you to do just that. mssql-cli being on Github, you could also check the source code for see how the login is handled, if you prefer that. Commented Jun 3, 2020 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.