Deploying phpMyAdmin on Azure Web App Site


Based on the original article located here:

In my previous post about the migration of a WordPress site to Windows Azure I mentioned that I used phpMyAdmin to import existing blog data into a MySql/ClearDb database in Windows Azure. phpMyAdmin is a web based tool for administering MySql databases. It can be used to create tables, edit the data in tables, export/import/backup data and many other tasks. I found it to be an adequate tool for all MySql db administration needs in Windows Azure. This post describes how to install and configure phpMyAdmin on Windows Azure Web Sites.

1. Create an empty site

First you’ll need to create a new site in Windows Azure. 10 free sites are allowed per subscription and phpMyAdmin will work fine on a free site. Create an empty site using “Quick Create” option in Windows Azure Portal:

2. Link the site with a MySql database

If you already have a MySql database or need to create one then use the Linked Resources page to link that database with your site.

Once the database is linked get the connection string by using the “View conneciton strings” link on the site’s dashboard page:

You will need the information from this connection string to logon to the database via phpMyAdmin. It will looks similar to this:

  1. Database=some-db-name;Data Source=some-hostname;User Id=some-username;Password=some-password  

3. Download and configure phpMyAdmin

Get the latest version of phpMyAdmin from the offical site. Extract it to some temporary location on your hard drive. Create a new file with name in the same directory where examples,jslibrariessetup and themes directories are. Paste the following into that file:

  1. <?php  
  2. $cfg['blowfish_secret'] = 'ba17c1ec07d65003';  // use here a value of your choice  
  3. $i = 0;  
  4. /* First server */  
  5. $i++;  
  6. /* Authentication type */  
  7. $cfg['Servers'][$i]['auth_type'] = 'cookie';  
  8. /* Server parameters */  
  9. $cfg['Servers'][$i]['host'] = 'some-hostname';  // Replace with value from connection string  
  10. $cfg['Servers'][$i]['connect_type'] = 'tcp';  
  11. $cfg['Servers'][$i]['compress'] = false;  
  12. $cfg['Servers'][$i]['extension'] = 'mysqli';  
  13. $cfg['Servers'][$i]['AllowNoPassword'] = false;  
  14. ?>  

5. Upload phpMyAdmin files to Windows Azure

Multiple upload methods are supported. I used FTP with FileZilla. FTP hostname and username can be obtained from the site’s dashboard page in management portal. Once you connected via FTP, upload all the files into the /site/wwwroot/ directory.

6. Logon to MySql database

Browse to the newly created site. You should see the phpMyAdmin logon page:

Use the User Id and Password from the connection string to logon.