Whenever I run
sqlcmd I get "command not found"
sqlcmd -S localhost -U SA -P '<YourPassword>' sqlcmd: command not found
How can I resolve that?
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
There are two methods of resolving this.
HINT: Do NOT follow the advice of the tutorial You can find the tutoral's (reproduced here)**. The tutorial states the following.
/opt/mssql-tools/bin/to your PATH environment variable in a bash shell.
To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc source ~/.bashrc
This works, but it's subpar.
Follow the Filesystem Hierarchy Standard
sudo ln -s /opt/mssql-tools/bin/* /usr/local/bin/
This should just be in their
postinst script, but you know... Microsoft etc.,