Let’s migrate a Phpmysql site from Godaddy to Azure App Service and Mysql
Go to Marketplace; let’s create a resource group


Web App + Database

Lets use PHP run time stack

It auto-creates MySQL with the wizard with proper private DNS zone

Generated resources after creation

App service is online now

Created Windows 10 VM and Installed SQL Workbench in the same vNet to connect to MySQL and App service FTP easily

You can download SSL and connection information from here.

Connect using MySQL Workbench

Enter the obtained password

Import your old database using .SQL export and import
Choose Target schema

Now DB is imported.

Now you can see Tables have been created.
You can see appropriate tables populated

Let’s load a test PHP file to test DB connectivity , You can see the FTP Credentials

Connect to App Service using FTP

if you are using WinSCP

Placed this file to test mySQL connectivity.

<?php $servername = "azure365pro-com-server.mysql.database.azure.com"; $username = "izmayfiuav"; $password = "8EHW56653KRSH5MZ$"; $database_name = "azure365pro-com-database"; // Create connection $conn = new mysqli($servername, $username, $password, $database_name); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully"; ?>
Connection failed: Connections using insecure transport are prohibited while –require_secure_transport=ON.

if you turn off secure transport

if you turn off secure transport

or use SSL from the PHP side (Recommended)

&lt;?php $servername = "azure365pro-com-server.mysql.database.azure.com"; $username = "izmayfiuav"; $password = "8EHW56653KRSH5MZ$"; $database_name = "azure365pro-com-database"; $options = array( PDO::MYSQL_ATTR_SSL_CA =&gt; '/DigiCertGlobalRootCA.crt.pem' ); // Create connection $conn = new mysqli($servername, $username, $password, $database_name, $options); // Check connection if ($conn-&gt;connect_error) { die("Connection failed: " . $conn-&gt;connect_error); } echo "Connected successfully"; ?&gt;
