Databases Azure

MySQL with phpMyAdmin on Windows Server 2025 on Azure User Guide

| Product: MySQL with phpMyAdmin on Windows Server 2025

Overview

MySQL is the open source relational database behind a large share of web applications, and phpMyAdmin is the web interface most people use to run it: from a web browser you create databases and tables, browse and edit rows, run SQL, import and export data, and manage user accounts and their privileges.

This image runs MySQL Community Server 8.4.13 (the 8.4 long term support release line) with phpMyAdmin 5.2.3 on Windows Server 2025 Datacenter (Desktop Experience), served by IIS with PHP 8.3. phpMyAdmin is served over HTTPS on port 443 and port 80 redirects to HTTPS. MySQL listens on 127.0.0.1 only, so the database itself is never reachable from the network: you reach it through phpMyAdmin, or from the VM. On the first boot of every VM the image creates this VM's own MySQL server and its passwords, phpMyAdmin's secret and configuration, and a TLS certificate for this VM; IIS serves nothing until that is done. The Windows Server licence is included in the virtual machine price that Microsoft bills; MySQL Community Server and phpMyAdmin are free software under the GNU General Public License v2. cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours.

What is included:

  • MySQL Community Server 8.4.13 LTS from Oracle's Windows archive (checksum and signature verified), as the Windows service MySQL84, running as its own virtual account and listening on 127.0.0.1 only
  • phpMyAdmin 5.2.3 from phpmyadmin.net (checksum and signature verified), in C:\Program Files\phpMyAdmin\phpmyadmin, with its config.inc.php one folder above it, where IIS never serves it
  • phpMyAdmin's configuration storage (bookmarks, history, designer, favourites) in its own phpmyadmin database, run by its own control account
  • IIS serving phpMyAdmin in its own application pool phpMyAdmin (No Managed Code, its own ApplicationPoolIdentity), with the IIS URL Rewrite module
  • PHP 8.3.37 (non thread safe, x64) under IIS FastCGI, with the extensions phpMyAdmin uses and OPcache on, and 64 MB uploads for imports
  • A per-VM password for the dbadmin MySQL account (every privilege) that you sign in to phpMyAdmin with, and for MySQL's root account
  • HTTPS on TCP 443 with this VM's own self signed certificate, TCP 80 redirecting to HTTPS, and Windows Firewall rules for both
  • Windows Server 2025 Datacenter, patched with Windows Update at build, with Microsoft Defender Antivirus and Windows Firewall on
  • cloudimg's support team on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours

Prerequisites

An active Azure subscription, a Remote Desktop client, and a virtual network in the target region. Standard_B2ms (2 vCPU, 8 GiB RAM) is a good starting point for development and small databases; choose a larger size, with more memory, for bigger databases or many connections. In the network security group, allow inbound TCP 3389 (Remote Desktop) and TCP 443 (phpMyAdmin) from your own address ranges only, and TCP 80 (the redirect to HTTPS) from the same ranges. phpMyAdmin is an administration tool: never open it to the whole internet.

Step 1: Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for MySQL with phpMyAdmin on Windows Server 2025 by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size, and set the Administrator account username and password. Under Inbound port rules allow RDP (3389), HTTP (80) and HTTPS (443), then narrow each rule's source to your own address ranges on the Networking tab. Select Review + create, then Create.

Step 2: Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn cloudimg1647283583153:mysql-phpmyadmin-windows-server:default:latest

az vm create \
  --resource-group <your-rg> \
  --name mysql-phpmyadmin \
  --image cloudimg1647283583153:mysql-phpmyadmin-windows-server:default:latest \
  --size Standard_B2ms \
  --admin-username <admin-name> \
  --admin-password '<a strong password>' \
  --public-ip-sku Standard

az vm open-port --resource-group <your-rg> --name mysql-phpmyadmin --port 3389 --priority 1000
az vm open-port --resource-group <your-rg> --name mysql-phpmyadmin --port 443 --priority 1010
az vm open-port --resource-group <your-rg> --name mysql-phpmyadmin --port 80 --priority 1020

az vm open-port opens each port to any address; narrow every rule to your own address ranges in the network security group afterwards.

First boot takes a few minutes. When the VM first starts, Windows finishes its setup, then the image creates this VM's MySQL server, accounts, passwords and certificate and starts IIS. Until then phpMyAdmin does not answer on ports 80 and 443. The setup is finished when the file C:\ProgramData\phpMyAdmin\cloudimg-firstboot.done exists (Step 4).

Step 3: Connect with Remote Desktop

Connect to the VM's public IP address with your Remote Desktop client (on Windows, mstsc; on macOS, Windows App), signing in with the administrator name and password you set at deployment. Open Windows PowerShell as administrator for the commands below. mysql and php are on the system path.

Step 4: Confirm MySQL and phpMyAdmin are running

Get-Content C:\ProgramData\phpMyAdmin\cloudimg-firstboot.done
Get-Service W3SVC, MySQL84 | Format-Table Status, StartType, Name, DisplayName -AutoSize
Get-NetTCPConnection -State Listen -LocalPort 80, 443, 3306 | Sort-Object LocalPort | Format-Table LocalAddress, LocalPort, @{n='Process';e={(Get-Process -Id $_.OwningProcess).ProcessName}} -AutoSize
(Select-String -Path 'C:\Program Files\phpMyAdmin\phpmyadmin\libraries\classes\Version.php' -Pattern 'VERSION = ').Line.Trim()
& 'C:\Program Files\PHP\php.exe' -r 'echo PHP_VERSION, PHP_EOL;'
& 'C:\Program Files\MySQL\MySQL Server 8.4\bin\mysql.exe' --version
done 2026-12-03T06:43:48.9255642Z address=<vm-public-ip> certificate=35287703E4A3C73A57113A17886F1BA300A94CAF

 Status StartType Name    DisplayName
 ------ --------- ----    -----------
Running Automatic MySQL84 MySQL 8.4
Running Automatic W3SVC   World Wide Web Publishing Service

LocalAddress LocalPort Process
------------ --------- -------
::                  80 System
::                 443 System
127.0.0.1         3306 mysqld

public const VERSION = '5.2.3' . VERSION_SUFFIX;

8.3.37

C:\Program Files\MySQL\MySQL Server 8.4\bin\mysql.exe  Ver 8.4.13 for Win64 on x86_64 (MySQL Community Server - GPL)

The first line shows when first boot finished, the address it named the certificate for (the VM's public IP address) and the certificate's thumbprint. IIS (W3SVC) and MySQL (MySQL84) start automatically with Windows. Ports 80 and 443 belong to System because IIS listens through the Windows HTTP stack, and MySQL listens on 127.0.0.1 only, so the database is never reachable from the network. The last three lines are the phpMyAdmin, PHP and MySQL versions.

An elevated PowerShell window on a new VM: IIS and MySQL running and set to start automatically, ports 80 and 443 on IIS and 3306 on 127.0.0.1 only, and the phpMyAdmin, PHP and MySQL versions

Step 5: Read your passwords

First boot wrote this VM's passwords to a file that only the SYSTEM account and the Administrators group can read:

Get-Content C:\ProgramData\phpMyAdmin\mysql-phpmyadmin-credentials.txt
MySQL 8.4 with phpMyAdmin on Windows Server 2025 by cloudimg: this VM's own credentials, made at its first boot.
phpMyAdmin: https://<vm-public-ip>/  (sign in as dbadmin; phpMyAdmin refuses root)
MYSQL_DBADMIN_USERNAME=dbadmin
MYSQL_DBADMIN_PASSWORD=<this VM's own password>
MYSQL_ROOT_USERNAME=root
MYSQL_ROOT_PASSWORD=<this VM's own password>
MySQL listens on 127.0.0.1:3306 only (service MySQL84). The HTTPS certificate is self-signed for this VM: replace it with your own.
Change these passwords (phpMyAdmin: User accounts) and see the user guide:
https://www.cloudimg.co.uk/guides/mysql-phpmyadmin-on-windows-server-2025-azure/

MYSQL_DBADMIN_PASSWORD is the password of dbadmin, the MySQL account with every privilege that you sign in to phpMyAdmin with. MYSQL_ROOT_PASSWORD is MySQL's own root account, which works from the VM only: phpMyAdmin refuses root (and any account without a password), so use dbadmin in the browser. Keep the file safe, and change both passwords after your first sign-in (Step 7).

Step 6: Sign in to phpMyAdmin

On your own computer, browse to https://<vm-public-ip>/. The certificate is this VM's own self signed one, so your browser warns about it the first time: accept it to continue (or use your own domain and a trusted certificate, see Use your own domain and certificate below). http:// addresses redirect to HTTPS. Sign in as dbadmin with the password from Step 5.

phpMyAdmin's sign-in page in Microsoft Edge on the VM, served by IIS over HTTPS, with the username dbadmin

Well known default sign-ins such as root with no password, root/root or admin/admin do not work on this image: the only account phpMyAdmin accepts is dbadmin, with this VM's own password. After signing in, the home page shows the MySQL server, the web server and phpMyAdmin's version:

phpMyAdmin's home page after signing in as dbadmin: MySQL 8.4.13 on this VM over 127.0.0.1, IIS 10 and PHP 8.3, and phpMyAdmin 5.2.3

Step 7: Create a database and its own account

Select Databases, type a name under Create database, leave Collation as it is for the server's default, utf8mb4_0900_ai_ci (full Unicode) and select Create. The list shows MySQL's own system databases and phpmyadmin, phpMyAdmin's configuration storage: leave those as they are.

phpMyAdmin's Databases page: the form to create a database, and MySQL's system databases with phpMyAdmin's configuration storage

Give each application its own MySQL account with rights on its own database only. Select User accounts, then Add user account: set a User name, set Host name to localhost for an application on this VM, type or generate a password, tick Create database with same name and grant all privileges, and select Go. The overview lists every account: dbadmin and root, pma (phpMyAdmin's control account, rights on the phpmyadmin database only) and MySQL's own mysql.* system accounts.

phpMyAdmin's User accounts overview: dbadmin, root and phpMyAdmin's control account pma, each on this VM only, and MySQL's system accounts

Then change the two passwords from Step 5: on the home page, Change password sets dbadmin's own; for root, select Edit privileges on its row under User accounts, then Login information. The credentials file keeps the first passwords, so delete it once you have stored the new ones safely.

Step 8: Use MySQL from the VM

The mysql client is on the system path. From an elevated PowerShell window, sign in as dbadmin (it asks for the password) and run SQL:

mysql --host=127.0.0.1 --user=dbadmin --password

Applications on this VM connect to 127.0.0.1, port 3306. MySQL listens on nothing else, so other machines cannot reach it; to let them, see Reach MySQL from other machines below.

Step 9: Check the identities everything runs as

phpMyAdmin's pages run in the IIS application pool phpMyAdmin under its own ApplicationPoolIdentity, a low privilege account that can read PHP and phpMyAdmin and change only its own temporary, session and log folders. MySQL runs as its own virtual account, NT SERVICE\MySQL84. From PowerShell, with the permissions of phpMyAdmin's config.inc.php and of the credentials file:

Import-Module WebAdministration
Get-ChildItem IIS:\AppPools | Select-Object Name, State, @{n='Identity';e={$_.processModel.identityType}} | Format-Table -AutoSize
Get-CimInstance Win32_Service -Filter "Name='MySQL84'" | Format-List Name, StartName, StartMode, State
(Get-Acl 'C:\Program Files\phpMyAdmin\config.inc.php').Access | Format-Table IdentityReference, FileSystemRights -AutoSize
(Get-Acl C:\ProgramData\phpMyAdmin\mysql-phpmyadmin-credentials.txt).Access | Format-Table IdentityReference, FileSystemRights -AutoSize
name       state   Identity
----       -----   --------
phpMyAdmin Started ApplicationPoolIdentity

Name      : MySQL84
StartName : NT SERVICE\MySQL84
StartMode : Auto
State     : Running

IdentityReference       FileSystemRights
-----------------       ----------------
NT AUTHORITY\SYSTEM          FullControl
BUILTIN\Administrators       FullControl
IIS APPPOOL\phpMyAdmin Read, Synchronize

IdentityReference      FileSystemRights
-----------------      ----------------
NT AUTHORITY\SYSTEM         FullControl
BUILTIN\Administrators      FullControl

config.inc.php holds this VM's phpMyAdmin secret and the control account's password: only the phpMyAdmin pool can read it, besides SYSTEM and Administrators. The credentials file is SYSTEM and Administrators only.

An elevated PowerShell window: the phpMyAdmin pool on its own identity, MySQL as NT SERVICE\MySQL84, config.inc.php readable by the pool only, and the credentials file readable by SYSTEM and Administrators only

Server Components

Component Version or setting Where
MySQL Community Server 8.4.13 LTS, service MySQL84 (NT SERVICE\MySQL84), 127.0.0.1:3306 only, utf8mb4, X Protocol off, local_infile off, secure_file_priv NULL C:\Program Files\MySQL\MySQL Server 8.4, data and my.ini in C:\ProgramData\MySQL\MySQL Server 8.4
phpMyAdmin 5.2.3, cookie sign-in, root and empty passwords refused, configuration storage in the phpmyadmin database C:\Program Files\phpMyAdmin\phpmyadmin (the web root), C:\Program Files\phpMyAdmin\config.inc.php
Web server IIS 10, site phpMyAdmin, pool phpMyAdmin (ApplicationPoolIdentity, No Managed Code), IIS URL Rewrite 2.1 C:\Program Files\phpMyAdmin\phpmyadmin\web.config
PHP 8.3.37 NTS x64, IIS FastCGI, 512M memory, 64M uploads, 300 s per request C:\Program Files\PHP
HTTPS TCP 443, this VM's self signed certificate (RSA 2048, private key not exportable, valid 3 years) Cert:\LocalMachine\My, friendly name "phpMyAdmin web server (this VM, cloudimg)"
HTTP TCP 80, redirects to HTTPS Windows Firewall rules in the group phpMyAdmin
Windows Server 2025 Datacenter, Desktop Experience, build 26100

Filesystem Layout

Path What it holds
C:\Program Files\phpMyAdmin\phpmyadmin\ phpMyAdmin itself, the folder IIS serves. Its internal folders (libraries, templates, vendor, sql, locale) are never served
C:\Program Files\phpMyAdmin\config.inc.php phpMyAdmin's configuration: this VM's secret, the server, the control account. Read only for the phpMyAdmin pool
C:\Program Files\MySQL\MySQL Server 8.4\bin\ MySQL's programs: mysqld, mysql, mysqldump, mysqladmin
C:\ProgramData\MySQL\MySQL Server 8.4\my.ini MySQL's settings
C:\ProgramData\MySQL\MySQL Server 8.4\Data\ MySQL's data directory and its error log (<computer name>.err). MySQL's account, SYSTEM and Administrators only
C:\ProgramData\phpMyAdmin\tmp\, sessions\, log\ phpMyAdmin's temporary files, PHP's sessions and PHP's error log (php-errors.log)
C:\ProgramData\phpMyAdmin\mysql-phpmyadmin-credentials.txt This VM's passwords. SYSTEM and Administrators only
C:\ProgramData\phpMyAdmin\cloudimg-firstboot.log What first boot did (never a password or secret)

Managing the Services

From an elevated PowerShell window:

# restart the web server (phpMyAdmin)
iisreset

# restart MySQL
Restart-Service MySQL84

To confirm the HTTP redirect, the sign-in page, that config.inc.php and phpMyAdmin's setup script are never served, and this VM's certificate and bindings, define a small helper that shows the status line of an address without following redirects, then run the checks:

function Get-Status([string]$url) {
    $rq = [Net.HttpWebRequest]::Create($url); $rq.AllowAutoRedirect = $false; $rq.Timeout = 60000
    try { $rs = $rq.GetResponse() } catch [Net.WebException] { $rs = $_.Exception.Response; if (-not $rs) { return "no answer ($($_.Exception.Status))" } }
    try { "$([int]$rs.StatusCode) $($rs.StatusDescription) $($rs.Headers['Location'])".Trim() } finally { $rs.Close() }
}
Import-Module WebAdministration
Get-Status http://localhost/index.php
Get-Status https://localhost/
Get-Status https://localhost/config.inc.php
Get-Status https://localhost/setup/
Get-ChildItem Cert:\LocalMachine\My | Where-Object FriendlyName -like 'phpMyAdmin*' | Format-List Subject, NotAfter, FriendlyName
Get-WebBinding -Name phpMyAdmin | Format-Table protocol, bindingInformation -AutoSize
301 Moved Permanently https://localhost/index.php

200 OK

404 Not Found

404 Not Found

Subject      : CN=<vm-public-ip>
NotAfter     : 12/3/2029 6:43:17 AM
FriendlyName : phpMyAdmin web server (this VM, cloudimg)

protocol bindingInformation
-------- ------------------
http     *:80:
https    *:443:

Port 80 answers 301 Moved Permanently to the same address over HTTPS, the sign-in page answers 200, config.inc.php answers 404 because it lives outside the folder IIS serves, and phpMyAdmin's setup script is not on the image at all. The certificate is named for the VM's public IP address and is valid for three years.

An elevated PowerShell window: HTTP redirecting to HTTPS, the sign-in page answering 200, config.inc.php and the setup script answering 404, this VM's own certificate and the site's two bindings

On Startup

At the first start of your VM, the scheduled task cloudimg-firstboot (SYSTEM) runs once:

  1. It keeps IIS stopped and disabled, and creates C:\ProgramData\phpMyAdmin and C:\ProgramData\MySQL\MySQL Server 8.4 locked to SYSTEM and Administrators, with only the access the web server and MySQL need
  2. It reads the VM's public and private IP addresses from Azure, for the certificate and the credentials file
  3. It creates a new MySQL server for this VM: root on this VM only with its own password, dbadmin with every privilege and its own password, and phpMyAdmin's control account pma with rights on the phpmyadmin database only. The passwords are set before the server first listens, and never appear on a command line
  4. It registers and starts the MySQL84 service as its own virtual account, then creates phpMyAdmin's configuration storage with phpMyAdmin's own create_tables.sql
  5. It writes config.inc.php with this VM's own 32-byte secret and the control account's password, readable by the phpMyAdmin pool only
  6. It writes C:\ProgramData\phpMyAdmin\mysql-phpmyadmin-credentials.txt, readable by administrators only
  7. It creates this VM's TLS certificate, named for the VM's public and private addresses, and binds it to port 443
  8. It starts IIS, waits for phpMyAdmin's sign-in page at https://localhost/, sets IIS to start automatically, writes cloudimg-firstboot.done, then removes itself and its script

If anything fails, IIS stays stopped and the task starts again from a clean state at the next start. Every start after that, IIS and MySQL start with Windows.

Use your own domain and certificate

phpMyAdmin answers on any address of the VM. To use your own DNS name and a trusted certificate:

  1. Point your DNS name (for example db.example.com) at the VM's public IP address. A static public IP keeps that address across restarts.
  2. Import your certificate (a .pfx with its private key) into Cert:\LocalMachine\My and bind it to port 443 of the phpMyAdmin site:
$cert = Import-PfxCertificate -FilePath C:\path\to\db.example.com.pfx -CertStoreLocation Cert:\LocalMachine\My -Password (Read-Host -AsSecureString 'PFX password')
Import-Module WebAdministration
(Get-WebBinding -Name phpMyAdmin -Protocol https -Port 443).AddSslCertificate($cert.Thumbprint, 'My')
  1. Browse to https://db.example.com/ and sign in as before.

Reach MySQL from other machines

MySQL listens on 127.0.0.1 only. The safest way for an application elsewhere to reach it is over a private network: put the application in the same virtual network, then:

  1. In C:\ProgramData\MySQL\MySQL Server 8.4\my.ini, set bind-address to the VM's private IP address, and run Restart-Service MySQL84.
  2. In phpMyAdmin, add an account for the application with Host name set to the application's private IP address, and grant it rights on its own database only.
  3. Allow TCP 3306 in Windows Firewall from that address only (New-NetFirewallRule -DisplayName 'MySQL from app' -Direction Inbound -Protocol TCP -LocalPort 3306 -RemoteAddress <app-private-ip> -Action Allow), and in the network security group from the same address.

Never open port 3306 to the internet.

Security Recommendations

  • Keep phpMyAdmin and Remote Desktop to your own networks. Open TCP 443, 80 and 3389 only to the addresses you manage the VM from, and prefer a VPN, Azure Bastion or just-in-time access.
  • Change the dbadmin and root passwords after your first sign-in, then delete the credentials file.
  • Give each application its own MySQL account with rights on its own database only, and keep dbadmin for administration.
  • Use a trusted certificate for your own domain (see above).
  • Do not give this VM a managed identity unless you need one. PHP cannot reach the Azure Instance Metadata Service on this image (a Windows Firewall rule blocks it), but other programs on the VM can, and through it a managed identity's tokens.

Maintenance

  • Windows updates: Windows Update is on, as Microsoft ships it. Restarting the VM restarts IIS and MySQL automatically.
  • MySQL updates: 8.4 is MySQL's long term support release line. To update to a newer 8.4 release, back up first, stop MySQL84, replace the files in C:\Program Files\MySQL\MySQL Server 8.4 with those of the new release's Windows ZIP archive (keep C:\ProgramData\MySQL), and start the service again.
  • phpMyAdmin updates: phpMyAdmin's home page shows whether a newer version exists. To update, replace the files in C:\Program Files\phpMyAdmin\phpmyadmin with those of the new release, then copy libraries\vendor_config.php back from the old folder (it points phpMyAdmin at config.inc.php one folder up), and remove its setup and examples folders.
  • Back up your databases: with mysqldump (as dbadmin), for example mysqldump --host=127.0.0.1 --user=dbadmin --password --single-transaction --databases <name> > C:\backup\<name>.sql, or from phpMyAdmin's Export tab. Azure Backup for the whole VM is a simple alternative.
  • Logs: MySQL's error log is in its data directory, PHP's errors in C:\ProgramData\phpMyAdmin\log\php-errors.log, IIS's logs in C:\inetpub\logs\LogFiles, and first boot's in C:\ProgramData\phpMyAdmin\cloudimg-firstboot.log (it never contains a password).

Troubleshooting

phpMyAdmin does not answer, or cloudimg-firstboot.done is missing

First boot may still be running: give it a few minutes and check again. Its log shows how far it got:

Get-Content C:\ProgramData\phpMyAdmin\cloudimg-firstboot.log

"Access denied for user" or "Login without a password is forbidden"

Sign in as dbadmin (lower case), not root: phpMyAdmin refuses root on this image. Copy the password from MYSQL_DBADMIN_PASSWORD= in C:\ProgramData\phpMyAdmin\mysql-phpmyadmin-credentials.txt. If you changed the password, the file still holds the first one.

An import stops with "file too large" or a timeout

Imports through the browser are limited to 64 MB per file and 300 seconds. Compress the file (.gz or .zip), or import a larger one from the VM with the mysql client: mysql --host=127.0.0.1 --user=dbadmin --password <database> --execute="source C:/path/to/dump.sql".

MySQL does not start

Read the end of its error log, in the data directory:

Get-ChildItem 'C:\ProgramData\MySQL\MySQL Server 8.4\Data\*.err' | Get-Content -Tail 30

Forgot the Windows password

Use Reset password on the VM's page in the Azure portal.

Support

cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours. Contact support@cloudimg.co.uk.

MySQL is a trademark of Oracle Corporation and/or its affiliates. phpMyAdmin is a project of the Software Freedom Conservancy. cloudimg is not affiliated with or endorsed by Oracle or the phpMyAdmin project; the software is provided under its open source licence (GPL-2.0).