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
$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
Enter-PSSession $s
$env:path += “;C:\MySQL\bin”
setx PATH $env:path /M
mysql –version # displays the MySQL version
mysqld –initialize –console
Set-Content -Value “ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘PASSWORD’;” -Path c:\mysql\mysql-init.txt -Encoding Ascii
mysqld –init-file=c:\\mysql\\mysql-init.txt –console
mysqld –install
Get-Service MySQL Start-Service MySQL Get-Service MySQL
mysql –user=root –password=myPassword -Bse “SHOW DATABASES;” > mydatabase.txtNOTE: The output to a file is being redirected to a text file as interactive sessions are not supported
.\mydatabase.txt
MySQL is now operational on Nano Server.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.