phpMyAdmin on Windows Azure Web Sites

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 in the same directory where examples, js, libraries, setup and themes directories are. Paste the following into that file:

$cfg['blowfish_secret'] = 'ba17c1ec07d65003';  // use here a value of your choice
$i = 0;
/* First server */
/* 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.


ruslany on December 17th 2012 in PHP, WAWS

PoorFairAverageGoodExcellent (1 votes, average: 5.00 out of 5)

23 Responses to “phpMyAdmin on Windows Azure Web Sites”

  1. Gravatar ImageTom responded on 23 Dec 2012 at 3:26 am #


    This is a good article, my only thought is that there is no word on security. If you use PhpMyAdmin it is a good idea to use SSL while on the site, so your database credentials are never sent in the clear.



  2. Gravatar ImageFred responded on 20 Jan 2013 at 9:03 am #

    So do you need a PhpMyAdmin “web site” for every database? Or can you link all databases to PhpMyAdmin?

  3. Gravatar Imageruslany responded on 21 Jan 2013 at 9:58 am #

    Fred, in my tests, as long as the database server was the same, I was able to connect to different databases by using a single PhpMyAdmin site. When I used the username/password for a particular database, only that database was available in the phpMyAdmin.

  4. Gravatar ImageHashid Hameed responded on 30 Mar 2013 at 2:55 am #

    I am getting #2002 Cannot log in to the MySQL server Error. :-( Please help.

  5. Gravatar ImageJim responded on 11 Apr 2013 at 1:49 pm #

    Fantastic article, thanks. @Hashid – It sounds like you haven’t set the host correctly in the file.

  6. Gravatar ImageLasse Laursen responded on 08 May 2013 at 6:36 am #

    Hi I also get the #2002 error when trying to login. The hostname, how much of the connection string shall be used?

    Please do revert, as I need a fix for this.

    Thanks in advance



  7. Gravatar ImageSteve responded on 09 May 2013 at 7:45 am #

    Great post and easy even for a beginner to follow. Everything worked as described. Thanks!
    Now comes the issue of trying to import the mysql DB when it’s bigger than 2.048MB. I’ve tried creating and inserting the .htaccess file as described in many posts but it didn’t seem to work. And there’s no way to access the php.ini file that I’m aware of. It’s frustrating because the DB is only 6MB and I’m looking at having to rebuild my wordpress site by hand. Has anyone else had luck beating the 2MB limit?

  8. Gravatar ImageJason responded on 10 May 2013 at 6:11 am #

    I am also unable to get this to work. It states teh same error the person above has…#2002 Cannot log in to the MySQL server Error

    the settings are correct.

    Is it a must that you create a dedicated site for this? and upload into the root of that site? I didn’t do that. i had a site… created a folder and used that as the phpmyadmin directory.

    also… you have not stated what version that you were using of phpmyadmin, as the settings file in the latest version is different a bit.

    please advise.

  9. Gravatar ImageJason responded on 10 May 2013 at 6:18 am #

    Please disregard my previous post. It seems that you must not allow the phpmyadmin to use its own internal setup system in the setup folder.

    I believe that it didn’t work as the cookie secret was not in that file it created.

    Perhaps it would work if I had everything correct.

    I went back into your tutorial… followed it to a T and blamo – working phpmyadmin on azure!! hooray!

  10. Gravatar ImageDevon Sutton responded on 01 Jul 2013 at 8:09 pm #

    There is a simpler approach; to summarise before going into the details: You can access your remote azure MySQL database from your local phpmyadmin and use the import, export – all the functions you’re used to using on phpmyadmin.

  11. Gravatar ImageMonica responded on 28 Aug 2013 at 2:40 am #

    I’m getting the #2002 error both when I try to access phpmyadmin from the new website I created in azure with the helpt of this tutorial, and when I try to connect to it remotely from the phpmyadmin I have running on my localhost.

    Has anyone had any luck with this? I have no idea what I can do about that error and googling it doesn’t seem to help either. Any help would be appreciated! Thanks in advance.

  12. Gravatar Imagetoshi responded on 02 Jan 2014 at 9:31 pm #

    thank you! how can i be a super user?

  13. Gravatar Imageztv responded on 20 Jun 2014 at 5:56 am #

    Connection string from the database of from the website section?

  14. Gravatar ImageRoger Wiese responded on 30 Nov 2014 at 10:13 pm #


    This is really good news. I followed the steps but I get a 500 Server error.
    So, I went back through the steps again, found that I had done it all correct.

    500 error persists.
    Any clues for me?

  15. Gravatar ImageDR2073 responded on 06 Feb 2015 at 12:17 am #

    I got just blank page after – even no any error =(
    May be something changed?

  16. Gravatar ImageDR2073 responded on 06 Feb 2015 at 12:32 am #

    I think figured out what was wrong:
    just made two changes and now all working:
    removed comments like
    // Replace with value from connection string
    and made blowfish_secret shorter

  17. Gravatar ImageGenesis responded on 04 Apr 2015 at 10:52 pm #

    Hi I have the same problem , do not give me any error alone page remains blank , if someone help me please .

    Greetings and thanks for your attention.

  18. Gravatar Imageravi shukla responded on 31 Oct 2015 at 10:10 am #

    I am getting error: cannot login to mysql server. while i give correct username or password.

    Any help would be appreciated.

  19. Gravatar ImageSze Jie responded on 04 Nov 2015 at 8:44 pm #

    I have already followed all the steps, but i still can not logon phpMyAdmin page. The error i get is #1045 Cannot log in to the MySQL server.

    May i know if there is anything to do with $cfg['blowfish_secret'] ?

  20. Gravatar ImageAlexey responded on 25 Apr 2016 at 11:30 am #

    Bro you save me some time and some nerves – I am so glad I found you article. Had to migrate a WordPress Site for my client – try to do it through workbench it kept giving me trouble. Always have done it manually (request will time out 9-10) rather than plugins such as Duplicator. Just want to say huge thanks to you man!

  21. Gravatar ImageJohn responded on 13 May 2016 at 10:38 am #

    Thank You so much ! This worked ! :)

  22. Gravatar ImageASHISH BHARWAL responded on 04 Sep 2016 at 7:12 am #

    I am getting #2002 Cannot log in to the MySQL server Error. :-( Please help.

    And also am not able to do 2nd step i.e “Link the site with a MySql database” ?

    Please help me or provide a video session of this tutorial !!

  23. Gravatar ImageAndy responded on 22 Nov 2016 at 1:26 pm #

    Where is the exact location for filling the ‘host’ parameter? I’m not able to find the exact file…
    I’m using Microsoft Azure with WordPress and MySQL database. I followed all the explained steps on this helpful article, but from the phpmyadmin screen I got 2002 error

Trackback URI | Comments RSS

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

XML Markup: If You want to add XML code to the comment please XML encode it first, otherwise the code will not show up.

Recently Published Articles