Sql-server – Change sa password for SQL Server on a GNU/Linux machine

connectivityinstallationlinuxsql server

    Please enter a password for the system administrator (SA) account:
    Please confirm the password for the system administrator (SA) account:

    Setting system administrator (SA) account password...
    sqlservr: Debugger.cpp:531: static void Debugger::Print(const void *, unsigned int): Assertion `m_IsAttached' failed.
    find: `/usr/share/icons/Numix/numix-icon-theme-circle-master': Permission denied
    find: `/usr/lib/rhythmbox/plugins/rhythmbox-plugins-open-containing-folder-master': Permission denied
    find: `/usr/lib/rhythmbox/plugins/alternative-toolbar-master': Permission denied
    find: `/usr/lib/rhythmbox/plugins/rb-fileorganizer-master': Permission denied
    find: `/usr/lib/rhythmbox/plugins/suspend-plugin-master': Permission denied
    nohup: redirecting stderr to stdout

    Do you wish to start the SQL Server service now? [y/n]: y
    Do you wish to enable SQL Server to start on boot? [y/n]: n

You can use sqlservr-setup --enable-service to enable SQL Server to start
at boot.

Setup completed successfully.

I can make a connection to SQL Server at first, using it with DBeaver for 1 week. Today I wanted to change the sa password, so I ran

sudo /opt/mssql/bin/sqlservr-setup

…but it seems to have failed. I removed the SQL Server package and installed it again, but the password for sa always gives me that kind of error. I can't make any connection again because of password failure.

How can I perform a fresh installation? I have deleted all mssql on /opt but no luck. Or how can I change the current sa password?

Best Answer

What OS are you using?

To get a fresh installation you have to remove the data directory, after removing the mssql-server package:

sudo yum remove mssql-server OR sudo apt-get remove mssql-server

And then:

sudo rm -rf /var/opt/mssql

This will delete all your user databases, but will also remove the system databases, which will allow you to reinstall and, hence, re-specify the SA password upon reinstall.

Let me know if this works.