Query Microsoft SQL from CentOS7
- January 31st, 2020
- Posted in Documentation
- Write comment
Install the Microsoft repository into your yum configuration:
# curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
Disable the repository:
vi /etc/yum.repos.d/mssql-release.repo
…
enabled=0
…
Remove the unixODBC packages if applicable:
# yum remove unixODBC-utf16 unixODBC-utf16-devel
Install the driver and command line tools (if wanted):
# yum –enablerepo packages-microsoft-com-prod install msodbcsql17
# yum –enablerepo packages-microsoft-com-prod install mssql-tools
Add the tools directory to your PATH variable as required:
vi ~/.bash_profile ~/.bashrc
…
export PATH=”$PATH:/opt/mssql-tools/bin”
..
Add the tools to your current session:
export PATH=”$PATH:/opt/mssql-tools/bin”
Test with sqlcmd:
sqlcmd -U username -P password -S server -d database
No comments yet.