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:
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 config.inc.php in the same directory where examples, js, libraries, setup and themes directories are. Paste the following into that file:
<?php $cfg['blowfish_secret'] = 'ba17c1ec07d65003'; // use here a value of your choice $i = 0; /* First server */ $i++; /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ $cfg['Servers'][$i]['host'] = 'some-hostname'; // Replace with value from connection string $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = false; ?>
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.