sqlcmd not available after installing mssql-tools

18,950

Solution 1

Quoting the page you linked to:

Optional Step: Create symlinks to 'SQLCMD' and 'BCP' under /usr/bin/.

ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd 
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp

Solution 2

  1. Add the path either to ~/.bash_profile or ~/.profile if you don't have .bash_profile in your home directory.

    export PATH="$PATH:/opt/mssql-tools/bin" 
    
  2. Add the following path to your ~/.bashrc file

    export PATH="$PATH:/opt/mssql-tools/bin"
    
  3. Don't forget to update the path configuration by issuing the following command in your terminal window:

    source ~/.bashrc
    
Share:
18,950

Related videos on Youtube

Amir Heshmati
Author by

Amir Heshmati

Updated on September 18, 2022

Comments

  • Amir Heshmati
    Amir Heshmati almost 2 years

    I'm trying to access sql server database so i need sqlcmd but after following microsoft docs here and here. Running sqlcmd returns:

     sqlcmd: command not found 
    

    and I do have mssql-tools installed:

    amir@amir-pc:~$ sudo apt-get install mssql-tools
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    mssql-tools is already the newest version (14.0.2.0-1).
    

    What am i missing? Also i'm on 16.10 and i had no problem installing it on 16.04

  • Asim
    Asim over 7 years
    The commands might not work as it is, I had to remove the version numbers from binary paths like so: ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd