Connect SQLCMD in Linux using root user

Gnana Balaji Kanagaraj 41 Reputation points

Hi, how to connect SQLCMD in Linux using root user?
We have SA account which got automatically disabled and there is no other login available to enable the SA Account or login to SQL Server SSMS.

So, is there any way to login to SQL Server using system account like root on linux sql server?

Please need help. TIA.

SQL Server on Azure Virtual Machines
Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,515 questions
No comments
{count} votes

Accepted answer
  1. Dan Guzman 6,926 Reputation points

    You can reset sa password and enable the account on Linux with mssql-conf set-sa-password. This requires stopping SQL Server, changing the password, and restarting afterwards. Example commands below.

    sudo systemctl stop mssql-server  
    sudo /opt/mssql/bin/mssql-conf set-sa-password  
    sudo systemctl start mssql-server  
    No comments

2 additional answers

Sort by: Most helpful
  1. Seeya Xi-MSFT 12,516 Reputation points Microsoft Employee

    Hi @Gnana Balaji Kanagaraj ,

    You can follow Dan's step to change sa password.
    Change the SA Password
    1. Stop the mssql-server service:
    sudo systemctl stop mssql-server
    2. Change the SA password:
    sudo /opt/mssql/bin/mssql-conf set-sa-password
    3. Start the mssql-server service:
    sudo systemctl start mssql-server

    About another question, it is not possible to connect to SQLCMD with the root user in Linux. There are only two types of authentication for SQL Server: Windows authentication and SQL authentication.

    Best regards,

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments

  2. Gnana Balaji Kanagaraj 41 Reputation points

    Dears, Thanks for your response, i have changed SA Password using Dan Steps and as soon as i changed the password i could able to login to the SSMS and able to connect.

    No comments