If after installing Sql Server on Ubuntu you can’t run sqlcmd getting “sqlcmd: command not found” error then you need to check some things out.
First of all, make sure that have mssql-tools installed. If you are not sure you can simply try to install it:
sudo apt-get install mssql-tools
and if you already have it installed you will get something like this:
Reading package lists... Done Building dependency tree Reading state information... Done mssql-tools is already the newest version (14.0.3.0-1). 0 to upgrade, 0 to newly install, 0 to remove and 242 not to upgrade.
Otherwise, it will be installed on your system. When everything is installed you may still get “sqlcmd: command not found” error when you try to run sqlcmd if you have no proper symlinks created.
First of all, let’s see how this tool is called on your system. It might be called something like sqlcmd-13.0.1.0 or simply sqlcmd but it should be in /opt/mssql-tools/bin/ directory. Let’s see what we have there:
sudo ls /opt/mssql-tools/bin/sqlcmd*
After you get the name of the tool you can create a symlink:
sudo ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd
That’s it.
P.S. Here is a free service to backup SQL Server on Linux.
THAAANKS!!!!
Thank you! this article solve my problem.
Thanks!!!!
tnx a lot
Thank very much!
THX!
Thanks, it helped!
It said that failled to create symbolic link : permission denied!
What should I do in this situation?
Check permissions for the Linux account you try to run the command under
sudo ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd
you need to add sudo at the beginning
Thanks, I’ve updated the post.
Thanks
Thank you so much
You da real MVP
Thank you…
You solved my problem…
Thanks so much.
thanksssss
I could not solve the problem, when I trie : sudo apt-get install mssql-tools I had and error: Unable to correct problems, you have held broken packages.
Hi JOSE MARTINEZ,
Could you please try to execute the following command:
sudo dpkg –configure -a
and then
sudo apt-get install -f
Thank you!
Thank you so much. Works like a charm
Thank you very much
thank you
Thanks for the help. Solved my problem!
Thank you very much
Thanks a lot!
thanks
You solved my problem…
It solved my issue. I appreciate your help!
Thank you very much
thank you so much ….
thank you so much .. could not figure it out …
Thank you so muchhhhhhh.
Thank you so much. My problem has already been solved!
Thanks!!!
You save me
It worked thanks!!!
many thanks to you!!!
Thanks it worked for me.
Thanks, It worked for me
thank you, your solution works, my problem is solved
OMG, you’re my savior! Thank you so much!
Works like a charm. Thank you very much
Thanks
It’s work.
Thank u very much!
Thank u very much!