Some time ago, Pierre and I were delivering a Windows Server session to the Toronto ITPRO Usergroup when the following was asked:

“Can you install SQL on a Nano Server?”

SQL requires lots of features to be enabled in the underlying operating system. While it is possible to install SQL on a Server Core offering of Windows Server, albeit painful, SQL cannot be installed on a Nano Server at the time of this post being published. There is a possibility of SQL enablement that could occur with the utilization of containers which we’ll explore in a later post. With this in mind, it is possible to natively install MySQL on Nano. While it may not be as robust as SQL, for some this may just do the trick. This How-To post will detail the process required to complete this.

Step 1: Setup a Nano Server VM

Step 2: Installing MySQL on Nano Server

Download mysql-8.0.15-winx64.zip and unzip the file to a local folder on your admin machine Rename the innermost mysql-8.0.15-winx64 folder to MySQL Run the following PowerShell script from an elevated PowerShell console to copy the binaries to your Nano Server machine: $ip = “0.0.0.0” # Nano Server IP address $s = New-PSSession -ComputerName $ip -Credential ~\Administrator Copy-Item -ToSession $s -Path .\MySQL” -Destination C:\ -Force -Recurse

Step 3: Setting up your environment

Remote into your newly created Nano Server machine and enter the following: Enter-PSSession $s Enter the following to add the MySQL\bin folder to your path environment variable: $env:path += “;C:\MySQL\bin” Next you need to enter the following to make this change persist even after the Nano Server reboots: setx PATH $env:path /M Now enter the following to ensure the MySQL instance is present: mysql –version # displays the MySQL version Enter the following to initialize the MySQL daemon and ignore the warnings for now: mysqld –initialize –console Create mysql-init.txt and replace PASSWORD with your own: Set-Content -Value “ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘PASSWORD’;” -Path c:\mysql\mysql-init.txt -Encoding Ascii Pass mysql-init.txt to the MySQL daemon for initialization: mysqld –init-file=c:\\mysql\\mysql-init.txt –console Stop the daemon using Ctrl+C and type the following to install the service: mysqld –install The service is now installed, and needs to be started with the following: Get-Service MySQL Start-Service MySQL Get-Service MySQL Display the system databases using the assigned password established when mysql-init.txt was created and yes ignore the warning: mysql –user=root –password=myPassword -Bse “SHOW DATABASES;” > mydatabase.txt NOTE: The output to a file is being redirected to a text file as interactive sessions are not supported Enter the following to display the content of the mydatabase.txt .\mydatabase.txt

MySQL is now operational on Nano Server.