After installing MS SQL server on your local machine, you might want to connect with MS SQL server with command line.
sqlcmd -S localhost -U sa -P "<password>"
But instead of connecting with MS SQL server, you might get the error
"sqlcmd: command not found."
There might be mssql-tools or symlink issue. To resolve this error, use below commands.
The first method you should try is check
mssql-tools is installed. Run the below command in Terminal.
sudo apt-get install mssql-tools
If mssql-tools is already installed, you might get below output.
If it is not already installed, it will start installing. You might still get the error after installation complete. You need to create symlinks. Run the below command to check where
mssql-tools/bin/sqlcmd is installed.
sudo ls /opt/mssql-tools/bin/sqlcmd*
It will output the path something like:
Now create symlink of the command to /user/bin folder with below command.
sudo ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd
This option should fix the error and you can now access MS SQL server using that above command.
Was this article helpful?
Leave a comment
Copyright 2021 HackTheStuff