0

sqlcmd: command not found.

 1 year ago
source link: https://www.laravelcode.com/post/sqlcmd-command-not-found
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

sqlcmd: command not found.

  4359 views

  1 year ago

MS SQL

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.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
mssql-tools is already the newest version (17.7.1.1-1).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

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:

/opt/mssql-tools/bin/sqlcmd

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.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK