{"id":60913,"date":"2024-03-27T11:40:41","date_gmt":"2024-03-27T06:10:41","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=60913"},"modified":"2024-03-28T11:42:55","modified_gmt":"2024-03-28T06:12:55","slug":"use-mssql-as-default-database-with-drupal-10-windows","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/use-mssql-as-default-database-with-drupal-10-windows\/","title":{"rendered":"Use MSSQL as Default Database with Drupal 10 (Windows)"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">By default MariaDB, MySQL\/Percona, PostgreSQL and SQLite databases are available for Drupal. The purpose of this blog is to Use MSSQL as Default Database with Drupal 10 (Windows).\u00a0<\/span><\/p>\n<h2><strong>Let\u2019s start installing Xdebug 3 on MacOs<\/strong><\/h2>\n<p><b>Step 1 :<\/b><span style=\"font-weight: 400;\">\u00a0 First we need to install MSSQL database on Windows<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Go to <\/span><a href=\"https:\/\/www.microsoft.com\/en-in\/sql-server\/sql-server-downloads\"><span style=\"font-weight: 400;\">https:\/\/www.microsoft.com\/en-in\/sql-server\/sql-server-downloads<\/span><\/a><span style=\"font-weight: 400;\"> and download setup file<\/span><\/li>\n<\/ul>\n<p><b>Step 2:<\/b><span style=\"font-weight: 400;\"> Click on setup file and follows all steps to install SQL server<\/span><\/p>\n<p><b>Step 3:<\/b><span style=\"font-weight: 400;\"> After installing Sql server, need to install Microsoft SQL Server Management Studio (GUI)<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Got to <\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/ssms\/download-sql-server-management-studio-ssms?view=sql-server-ver16#download-ssms\"><span style=\"font-weight: 400;\">https:\/\/learn.microsoft.com\/en-us\/sql\/ssms\/download-sql-server-management-studio-ssms?view=sql-server-ver16#download-ssms<\/span><\/a><span style=\"font-weight: 400;\"> and download SSMS setup<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Click on setup file and follows all steps to install SSMS<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60909 size-large\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/mssql-1024x542.png\" alt=\"\" width=\"625\" height=\"331\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/mssql-1024x542.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/mssql-300x159.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/mssql-768x406.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/mssql-1536x813.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/mssql-624x330.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/mssql.png 1920w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">After installation of MSSQL database, check that PDO driver for SQL Server is installed or not by using below function:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;?php<\/span>\r\n<span style=\"font-weight: 400;\">  \u00a0 \u00a0echo phpinfo();<\/span>\r\n<span style=\"font-weight: 400;\">?&gt;<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">If not installed, then follow below steps:<\/span><\/p>\n<p><b>Step 1: <\/b><span style=\"font-weight: 400;\">Go to <\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/connect\/php\/download-drivers-php-sql-server?view=sql-server-ver16\"><span style=\"font-weight: 400;\">https:\/\/learn.microsoft.com\/en-us\/sql\/connect\/php\/download-drivers-php-sql-server?view=sql-server-ver16<\/span><\/a><span style=\"font-weight: 400;\"> and download zip archive<\/span><\/p>\n<p><b>Step 2:<\/b><span style=\"font-weight: 400;\"> Unzip the folder and choose the driver as per your PHP version and system configuration.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-60910\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/1-1024x533.png\" alt=\"\" width=\"625\" height=\"325\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/1-1024x533.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/1-300x156.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/1-768x400.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/1-1536x800.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/1-624x325.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/1.png 1890w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">For e.g. For PHP 8.1 version, copied above highlighted files and paste into C:\\xampp\\php\\ext\u00a0 folder<\/span><\/p>\n<p><b>Step 3:<\/b><span style=\"font-weight: 400;\"> After installing the driver, you need to enable it in your php.ini file. You can do this by adding the following lines:<\/span><\/p>\n<pre><strong>extension=php_pdo_sqlsrv_XX_ts.dll<\/strong>\r\n\r\n<strong>extension=php_sqlsrv_XX_ts.dll<\/strong><\/pre>\n<p><span style=\"font-weight: 400;\">Replace `XX` with your PHP version. For example, if you\u2019re using PHP 8.1, use `81`. And restart your server.<\/span><\/p>\n<h2><b>To download and install Drupal using composer<\/b><\/h2>\n<p><b>Step 1:<\/b><b> Run <\/b><span style=\"font-weight: 400;\">composer create-project drupal\/recommended-project my_site_name command in terminal.<\/span><\/p>\n<p><b>Step2: <\/b><span style=\"font-weight: 400;\">Install sqlsrv module which will communicate Drupal with MSSQL <\/span><span style=\"font-weight: 400;\">composer require &#8216;drupal\/sqlsrv:^4.4&#8217;<\/span><\/p>\n<p><b>Step3:<\/b><span style=\"font-weight: 400;\"> After installing above modules, SQL server options will be displayed under database types.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-60912\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-2024-03-21-at-3.56.12-PM-1024x826.png\" alt=\"\" width=\"625\" height=\"504\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-2024-03-21-at-3.56.12-PM-1024x826.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-2024-03-21-at-3.56.12-PM-300x242.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-2024-03-21-at-3.56.12-PM-768x620.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-2024-03-21-at-3.56.12-PM-1536x1239.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-2024-03-21-at-3.56.12-PM-2048x1652.png 2048w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-2024-03-21-at-3.56.12-PM-624x503.png 624w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><b>Step 4: <\/b><span style=\"font-weight: 400;\">After entering\u00a0 all the information, click on the submit button or paste below code in settings.php file<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">$databases['default']['default'] = array (<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'database' =&gt; 'XXXX',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'username' =&gt; XXX,<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'password' =&gt; 'XXXX',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'prefix' =&gt; '',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'host' =&gt; XXX,<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'port' =&gt; '1433',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'schema' =&gt; 'dbo',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'cache_schema' =&gt; 0,<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'autoload' =&gt; 'modules\/contrib\/sqlsrv\/src\/Driver\/Database\/sqlsrv\/',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'encrypt' =&gt; '1',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'trust_server_certificate' =&gt; '1',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'multi_subnet_failover' =&gt; 0,<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'namespace' =&gt; 'Drupal\\\\sqlsrv\\\\Driver\\\\Database\\\\sqlsrv',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0'driver' =&gt; 'sqlsrv',<\/span>\r\n\r\n<span style=\"font-weight: 400;\">);<\/span><\/pre>\n<h2><b>Conclusion<\/b><\/h2>\n<p>Finally, MSSQL database setup with Drupal 10 completed successfully.<\/p>\n<p>Let us know in case of any issues during the installation process, and please feel free to reach out via comments.<\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>By default MariaDB, MySQL\/Percona, PostgreSQL and SQLite databases are available for Drupal. The purpose of this blog is to Use MSSQL as Default Database with Drupal 10 (Windows).\u00a0 Let\u2019s start installing Xdebug 3 on MacOs Step 1 :\u00a0 First we need to install MSSQL database on Windows Go to https:\/\/www.microsoft.com\/en-in\/sql-server\/sql-server-downloads and download setup file Step [&hellip;]<\/p>\n","protected":false},"author":1599,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":144},"categories":[3602],"tags":[5261,5723],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60913"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1599"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=60913"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60913\/revisions"}],"predecessor-version":[{"id":61025,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60913\/revisions\/61025"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=60913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=60913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=60913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}