您当前的位置:首页 > 计算机 > 系统应用 > Linux

在Linux操作系统中安装SQL Server tools

时间:11-21来源:作者:点击数:

本文基于微软官方文档整理完成

https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-setup-tools

The following steps install the command-line tools, Microsoft ODBC drivers, and their dependencies. The mssql-tools package contains:

  • sqlcmd: Command-line query utility.
  • bcp: Bulk import-export utility.

Install the tools for your platform:

Install tools on RHEL

Use the following steps to install the mssql-tools on Red Hat Enterprise Linux.

  1. Enter superuser mode.
    sudo su
  2. Download the Microsoft Red Hat repository configuration file.
    curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
  3. Exit superuser mode.
    exit
  4. If you had a previous version of mssql-tools installed, remove any older unixODBC packages.
    sudo yum updatesudo yum remove unixODBC-utf16 unixODBC-utf16-devel
  5. Run the following commands to install mssql-tools with the unixODBC developer package.
    sudo yum updatesudo yum install mssql-tools unixODBC-devel

    Note

    To update to the latest version of mssql-tools run the following commands:

      sudo yum check-update  sudo yum update mssql-tools
  6. Optional: Add /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"' >> ~/.bashrcsource ~/.bashrc
方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
    无相关信息
栏目更新
栏目热门