Microsoft Mac Drivers
Download and install Microsoft OneDrive for Windows PC, Mac, iOS and Android. Download and install Microsoft OneDrive for Windows PC, Mac, iOS and Android. Skip to main content. Microsoft will use your mobile number or email address only for this one-time transaction. Your information won’t be stored. Standard SMS rates. Recommended updates for your Microsoft software. Xbox and games. Updates and developer tools. Windows Phone. Apps, SDKs, and updates. Hardware drivers. For printers, cameras, network cards, and more. This is your 365. Discover what's possible every day with Office 365.
This article explains how to install the Microsoft ODBC Driver for SQL Server on Linux. It also includes instructions for the optional command-line tools for SQL Server (bcp
and sqlcmd
) and the unixODBC development headers.
This article provides commands for installing the ODBC driver from the bash shell. If you want to download the packages directly, see Download ODBC Driver for SQL Server.
Microsoft ODBC 17
The following sections explain how to install the Microsoft ODBC driver 17 from the bash shell for different Linux distributions.
Important
If you installed the v17 msodbcsql
package that was briefly available, you should remove it before installing the msodbcsql17
package. This will avoid conflicts. The msodbcsql17
package can be installed side by side with the msodbcsql
v13 package.
Alpine Linux
Note
Driver version 17.5 or higher is required for Alpine support.
Debian
Note
You can substitute setting the environment variable 'ACCEPT_EULA' with setting the debconf variable 'msodbcsql/ACCEPT_EULA' instead: echo msodbcsql17 msodbcsql/ACCEPT_EULA boolean true sudo debconf-set-selections
Red Hat Enterprise Server and Oracle Linux
SUSE Linux Enterprise Server
Ubuntu
Note
- Driver version 17.2 or higher is required for Ubuntu 18.04 support.
- Driver version 17.3 or higher is required for Ubuntu 18.10 support.
Note
You can substitute setting the environment variable 'ACCEPT_EULA' with setting the debconf variable 'msodbcsql/ACCEPT_EULA' instead: echo msodbcsql17 msodbcsql/ACCEPT_EULA boolean true sudo debconf-set-selections
Previous versions
The following sections provide instructions for installing previous versions of the Microsoft ODBC driver on Linux. The following driver versions are covered:
ODBC 13.1
The following sections explain how to install the Microsoft ODBC driver 13.1 from the bash shell for different Linux distributions.
Debian 8
RedHat Enterprise Server 6
RedHat Enterprise Server 7
SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 12
Ubuntu 15.10
Ubuntu 16.04
Ubuntu 16.10
ODBC 13
The following sections explain how to install the Microsoft ODBC driver 13 from the bash shell for different Linux distributions.
RedHat Enterprise Server 6
RedHat Enterprise Server 7
Ubuntu 15.10
Ubuntu 16.04
SUSE Linux Enterprise Server 12
Offline installation
If you prefer/require the Microsoft ODBC Driver 13 to be installed on a computer with no internet connection, you will need to resolve package dependencies manually. The Microsoft ODBC Driver 13 has the following direct dependencies:
- Ubuntu: libc6 (>= 2.21), libstdc++6 (>= 4.9), libkrb5-3, libcurl3, openssl, debconf (>= 0.5), unixodbc (>= 2.3.1-1)
- Red Hat:
glibc, e2fsprogs, krb5-libs, openssl, unixODBC
- SUSE:
glibc, libuuid1, krb5, openssl, unixODBC
Each of these packages in turn has their own dependencies, which may or may not be present on the system. For a general solution to this issue, refer to your distribution's package manager documentation: Redhat, Ubuntu, and SUSE
It is also common to manually download all the dependent packages and place them together on the installation computer, then manually install each package in turn, finishing with the Microsoft ODBC Driver 13 package.
Redhat Linux Enterprise Server 7
- Download the latest
msodbcsql
.rpm
from https://packages.microsoft.com/rhel/7/prod/. - Install dependencies and the driver.
Ubuntu 16.04
- Download the latest
msodbcsql
.deb
from https://packages.microsoft.com/ubuntu/16.04/prod/pool/main/m/msodbcsql/. - Install dependencies and the driver.
SUSE Linux Enterprise Server 12
- Download the latest
msodbcsql
.rpm
from https://packages.microsoft.com/sles/12/prod/. - Install the dependencies and the driver.
After you have completed the package installation, you can verify that the Microsoft ODBC Driver 13 can find all its dependencies by running ldd and inspecting its output for missing libraries:
ODBC 11
The following sections explain how to install the Microsoft ODBC driver 11 on Linux. Before you can use the driver, install the unixODBC driver manager. For more information, see Installing the Driver Manager.
Installation Steps
Important
These instructions refer to msodbcsql-11.0.2270.0.tar.gz
, which is installation file for Red Hat Linux. If you are installing the Preview for SUSE Linux, the file name is msodbcsql-11.0.2260.0.tar.gz
.
To install the driver:
Make sure that you have root permission.
Change to the directory where the download placed the file
msodbcsql-11.0.2270.0.tar.gz
. Make sure that you have the *.tar.gz file that matches your version of Linux. To extract the files, execute the following command,tar xvzf msodbcsql-11.0.2270.0.tar.gz
.Change to the
msodbcsql-11.0.2270.0
directory and there you should see a file called install.sh.To see a list of the available installation options, execute the following command: ./install.sh.
Make a backup of odbcinst.ini. The driver installation updates odbcinst.ini. odbcinst.ini contains the list of drivers that are registered with the unixODBC Driver Manager. To discover the location of odbcinst.ini on your computer, execute the following command:
odbc_config --odbcinstini
.Before you install the driver, execute the following command:
./install.sh verify
. The output of./install.sh verify
reports if your computer has the required software to support the ODBC driver on Linux.When you are ready to install the ODBC driver on Linux, execute the command:
./install.sh install
. If you need to specify an install command (bin-dir
orlib-dir
), specify the command after the install option.After reviewing the license agreement, type YES to continue with the installation.
Installation puts the driver in /opt/microsoft/msodbcsql/11.0.2270.0
. The driver and its support files must be in /opt/microsoft/msodbcsql/11.0.2270.0
.
To verify that the Microsoft ODBC driver on Linux was registered successfully, execute the following command: odbcinst -q -d -n 'ODBC Driver 11 for SQL Server'
.
Uninstall
You can uninstall the ODBC driver 11 on Linux by executing the following commands:
rm -f /usr/bin/sqlcmd
rm -f /usr/bin/bcp
rm -rf /opt/microsoft/msodbcsql
odbcinst -u -d -n 'ODBC Driver 11 for SQL Server'
Driver files
The ODBC driver on Linux consists of the following components:
Component | Description |
---|---|
libmsodbcsql-17.X.so.X.X or libmsodbcsql-13.X.so.X.X | The shared object (so ) dynamic library file that contains all of the driver's functionality. This file is installed in /opt/microsoft/msodbcsql17/lib64/ for the Driver 17 and in /opt/microsoft/msodbcsql/lib64/ for Driver 13. |
msodbcsqlr17.rll or msodbcsqlr13.rll | The accompanying resource file for the driver library. This file is installed in [driver .so directory]./share/resources/en_US/ |
msodbcsql.h | The header file that contains all of the new definitions needed to use the driver. Note: You cannot reference msodbcsql.h and odbcss.h in the same program. msodbcsql.h is installed in /opt/microsoft/msodbcsql17/include/ for Driver 17 and in /opt/microsoft/msodbcsql/include/ for Driver 13. |
LICENSE.txt | The text file that contains the terms of the End-User License Agreement. This file is placed in /usr/share/doc/msodbcsql17/ for Driver 17 and in /usr/share/doc/msodbcsql/ for Driver 13. |
RELEASE_NOTES | The text file that contains release notes. This file is placed in /usr/share/doc/msodbcsql17/ for Driver 17 and in /usr/share/doc/msodbcsql/ for Driver 13. |
Resource file loading
The driver needs to load the resource file in order to function. This file is called msodbcsqlr17.rll
or msodbcsqlr13.rll
depending on the driver version. The location of the .rll
file is relative to the location of the driver itself (so
or dylib
), as noted in the table above. As of version 17.1 the driver will also attempt to load the .rll
from the default directory if loading from the relative path fails. The default resource file path on Linux is /opt/microsoft/msodbcsql17/share/resources/en_US/
.
Troubleshooting
If you are unable to make a connection to SQL Server using the ODBC driver, see the known issues article on troubleshooting connection problems.
Next steps
After installing the driver, you can try the C++ ODBC example application. For more information about developing ODBC applications, see Developing Applications.
For more information, see the ODBC driver release notes and system requirements.
-->The following instructions assume a clean environment and show how to install PHP 7.x, the Microsoft ODBC driver, the Apache web server, and the Microsoft Drivers for PHP for SQL Server on Ubuntu 16.04, 18.04, and 19.10, RedHat 7 and 8, Debian 8, 9, and 10, Suse 12 and 15, Alpine 3.11 (experimental), and macOS 10.13, 10.14, and 10.15. These instructions advise installing the drivers using PECL, but you can also download the prebuilt binaries from the Microsoft Drivers for PHP for SQL Server GitHub project page and install them following the instructions in Loading the Microsoft Drivers for PHP for SQL Server. For an explanation of extension loading and why we do not add the extensions to php.ini, see the section on loading the drivers.
These instructions install PHP 7.4 by default. Note that some supported Linux distros default to PHP 7.1 or earlier, which is not supported for the latest version of the PHP drivers for SQL Server -- please see the notes at the beginning of each section to install PHP 7.2 or 7.3 instead.
Also included are instructions for installing the PHP FastCGI Process Manager, PHP-FPM, on Ubuntu. This is needed if using the nginx web server instead of Apache.
Contents of this page:
Installing the drivers on Ubuntu 16.04, 18.04, and 19.10
Onenote mac without microsoft account login. Note
To install PHP 7.2 or 7.3, replace 7.4 with 7.2 or 7.3 in the following commands.
Step 1. Install PHP
Step 2. Install prerequisites
Install the ODBC driver for Ubuntu by following the instructions on the Linux installation article.
Step 3. Install the PHP drivers for Microsoft SQL Server
If there is only one PHP version in the system, then the last step can be simplified to phpenmod sqlsrv pdo_sqlsrv
.
Step 4. Install Apache and configure driver loading
Step 5. Restart Apache and test the sample script
To test your installation, see Testing your installation at the end of this document.
Installing the drivers with PHP-FPM on Ubuntu
Note
To install PHP 7.2 or 7.3, replace 7.4 with 7.2 or 7.3 in the following commands.
Step 1. Install PHP
Verify the status of the PHP-FPM service by running
Step 2. Install prerequisites
Install the ODBC driver for Ubuntu by following the instructions on the Linux installation article.
Step 3. Install the PHP drivers for Microsoft SQL Server
If there is only one PHP version in the system, then the last step can be simplified to phpenmod sqlsrv pdo_sqlsrv
.
Verify that sqlsrv.ini
and pdo_sqlsrv.ini
are located in /etc/php/7.4/fpm/conf.d/
:
Restart the PHP-FPM service:
Step 4. Install and configure nginx
To configure nginx, you must edit the /etc/nginx/sites-available/default
file. Add index.php
to the list below the section that says # Add index.php to the list if you are using PHP
:
Next, modify the section following # pass PHP scripts to FastCGI server
as follows:
Step 5. Restart nginx and test the sample script
To test your installation, see Testing your installation at the end of this document.
Installing the drivers on Red Hat 7 and 8
Step 1. Install PHP
Microsoft remote desktop 10 mac. To install PHP on Red Hat 7, run the following:
Note
To install PHP 7.2 or 7.3, replace remi-php74 with remi-php72 or remi-php73 respectively in the following commands.
To install PHP on Red Hat 8, run the following:
Note
To install PHP 7.2 or 7.3, replace remi-7.4 with remi-7.2 or remi-7.3 respectively in the following commands.
Step 2. Install prerequisites
Install the ODBC driver for Red Hat 7 or 8 by following the instructions on the Linux installation article.
Step 3. Install the PHP drivers for Microsoft SQL Server
You can alternatively install from the Remi repo:
Step 4. Install Apache
SELinux is installed by default and runs in Enforcing mode. To allow Apache to connect to databases through SELinux, run the following command:
Step 5. Restart Apache and test the sample script
To test your installation, see Testing your installation at the end of this document.
Installing the drivers on Debian 8, 9, and 10
Note
To install PHP 7.2 or 7.3, replace 7.4 in the following commands with 7.2 or 7.3.
Step 1. Install PHP
Step 2. Install prerequisites
Install the ODBC driver for Debian by following the instructions on the Linux installation article.
You may also need to generate the correct locale to get PHP output to display correctly in a browser. For example, for the en_US UTF-8 locale, run the following commands:
You may need to add /usr/sbin
to your $PATH
, as the locale-gen
executable is located there.
Microsoft Mac Torrent
Step 3. Install the PHP drivers for Microsoft SQL Server
If there is only one PHP version in the system, then the last step can be simplified to phpenmod sqlsrv pdo_sqlsrv
. As with locale-gen
, phpenmod
is located in /usr/sbin
so you may need to add this directory to your $PATH
.
Step 4. Install Apache and configure driver loading
Step 5. Restart Apache and test the sample script
To test your installation, see Testing your installation at the end of this document.
Installing the drivers on Suse 12 and 15
Note
In the following instructions, replace <SuseVersion>
with your version of Suse - if you are using Suse Enterprise Linux 15, it will be SLE_15 or SLE_15_SP1. For Suse 12, use SLE_12_SP4 (or above if applicable). Not all versions of PHP are available for all versions of Suse Linux - please refer to http://download.opensuse.org/repositories/devel:/languages:/php
to see which versions of Suse have the default version PHP available, or to http://download.opensuse.org/repositories/devel:/languages:/php:/
to see which other versions of PHP are available for which versions of Suse.
Note
Packages for PHP 7.4 are not available for Suse 12.To install PHP 7.2, replace the repository URL below with the following URL:https://download.opensuse.org/repositories/devel:/languages:/php:/php72/<SuseVersion>/devel:languages:php:php72.repo
.To install PHP 7.3, replace the repository URL below with the following URL:https://download.opensuse.org/repositories/devel:/languages:/php:/php73/<SuseVersion>/devel:languages:php:php73.repo
.
Step 1. Install PHP
Step 2. Install prerequisites
Install the ODBC driver for Suse by following the instructions on the Linux installation article.
Step 3. Install the PHP drivers for Microsoft SQL Server
Note
If you get an error message saying Connection to 'pecl.php.net:443' failed: Unable to find the socket transport 'ssl'
, edit the pecl script at /usr/bin/pecl and remove the -n
switch in the last line. This switch prevents PECL from loading ini files when PHP is called, which prevents the OpenSSL extension from loading.
Step 4. Install Apache and configure driver loading
Step 5. Restart Apache and test the sample script
To test your installation, see Testing your installation at the end of this document.
Installing the drivers on Alpine 3.11
Note
The default version of PHP is 7.3. Alternate versions of PHP are not available from other repositories for Alpine 3.11. You can instead compile PHP from source.
Microsoft Keyboard Drivers Mac
Step 1. Install PHP
PHP packages for Alpine are found in the edge/community
repository. Add the following line to /etc/apt/repositories
, replacing <mirror>
with the URL of an Alpine repository mirror:
Then run:
Step 2. Install prerequisites
Install the ODBC driver for Alpine by following the instructions on the Linux installation article.
Step 3. Install the PHP drivers for Microsoft SQL Server
You may need to define a locale:
Step 4. Install Apache and configure driver loading
Step 5. Restart Apache and test the sample script
To test your installation, see Testing your installation at the end of this document.
Installing the drivers on macOS High Sierra, Mojave, and Catalina
If you do not already have it, install brew as follows:
Note
To install PHP 7.2 or 7.3, replace php@7.4 with php@7.2 or php@7.3 respectively in the following commands.
Step 1. Install PHP
PHP should now be in your path -- run php -v
to verify that you are running the correct version of PHP. If PHP is not in your path or it is not the correct version, run the following:
Step 2. Install prerequisites
Install the ODBC driver for macOS by following the instructions on the macOS installation article.
In addition, you may need to install the GNU make tools:
Step 3. Install the PHP drivers for Microsoft SQL Server
Step 4. Install Apache and configure driver loading
To find the Apache configuration file, httpd.conf
, for your Apache installation, run
The following commands append the required configuration to httpd.conf
. Be sure to substitute the path returned by the preceding command in place of /usr/local/etc/httpd/httpd.conf
:
Step 5. Restart Apache and test the sample script
To test your installation, see Testing your installation at the end of this document.
Microsoft Mac Drivers Free
Testing Your Installation
To test this sample script, create a file called testsql.php in your system's document root. This is /var/www/html/
on Ubuntu, Debian, and Redhat, /srv/www/htdocs
on SUSE, /var/www/localhost/htdocs
on Alpine, or /usr/local/var/www
on macOS. Copy the following script to it, replacing the server, database, username, and password as appropriate. On Alpine 3.11, you may also need to specify the CharacterSet as 'UTF-8' in the $connectionOptions
array.
Point your browser to https://localhost/testsql.php (https://localhost:8080/testsql.php on macOS). You should now be able to connect to your SQL Server/Azure SQL database.