Maria Naggaga

Microsoft Tech Evangelist NYC

Connecting a new MySQL Database to an existing Azure WordPress Site

In my previous post ,  I went through how to provision a  MySQL database for an existing  website.   Now, that you have a  provision a  database  for your site the next step  is to connect the two of them together.   Currently there is no way to connect a new  database to an existing website  using the  Azure portal. If you are in this situation before you will need to manually to this using  some sort of  cloud connected web development  tool like Web Matrix .

Getting Rid of  HTTP 500

The first thing you might want to do is update the connection  string  using  the Azure portal.   Follow the steps below to reset the data connection

  • Login into Azure
  • Select website
  • Select configure tab
  • Scroll down to connection string
  • Click show connection string
  • Edit information with: database name , connection string , and type of  database.
    Format of connection string: Database= database name; Data Source=us-cdbr-azure-northcentral-a.cleardb.com;User Id= series of letters and numbers;Password=******.
    If you try to access your site after you will notice that you still get  the HTTP 500 response.

Note:  To retrieve to  the connection string information please visit the clearDB site .   For a step by step process please review previous post.

The Answer !  WebMatrix

I tried a lot of hair pulling solutions like Azure powershell commands, and FTP clients before I thought about using WebMatrix 3.  When you initially signup for an Azure Subscription  you are going to download suite of tools including WebMatrix3.

WebMatrix3 is a free tool that provides easy access to azure websites. This tool makes it easier to find and open your site files, as well as seamless transition between remote and local versions of the site.

 Configuring your database  

 Step 1 :  Access your site

  1. Start  WebMatrix3 (For Download)
  2. Select MySites from the quick start menu.
  3. Select  the site you are working on

 Step 2 :  Check Compatibility

  1.  Select the remote , then click on check compatibility
  2. You will notice an alert icon besides database availability.
  3. Click on settings besides the check compatibility icon.
  4. Edit the connection string with information above.  (format should be something like this Database= database name; Data Source=us-cdbr-azure-northcentral-a.cleardb.com;User Id= series of letters and numbers;Password=****** )
  5. Click save
  6. Click Validate connection

Step 3: Updating  the configuration php file

    1. Click open remote view 
    2. Open wp-config.php file and edit  the following lines of code below
          // ** MySQL settings - You can get this info from your web host ** //
         /** The name of the database for WordPress */
          define('DB_NAME', 'ENTER DB_NAME');

        /** MySQL database username */
          define('DB_USER', 'ENTER DB_USER');

        /** MySQL database password */
          define('DB_PASSWORD', 'ENTER DB_PASSWORD ');

          /** MySQL hostname */
          define('DB_HOST','us-cdbr-azure-northcentral-a.cleardb.com'); 
         /** NOTE HOST CHANGES DEPENDING ON ENDPOINT LOCATION */
  1. Hit Run
    RUN

If you have just lifted up your hands up in victory your website is up and running. My last  two post described how I re-provisioned,  backed-up, and reconnected a database to  my existing blog .

I hope this helped & happy blogging!  

 

1 Comment

  1. Hello there I am sso happy I found your webpage, I really found you by error, while I was looking on Digg for something else, Regardless I am here now and would just like to
    say thhanks a lot for a marvelous popst and a aall round interesting blog
    (I also love thee theme/design), I don’t have tiime to go through itt all at the moment but I have saved it and also included your
    RSS feeds, so when I have time I will be bback to read more,Please do keep up the excellent b.

Leave a Reply

Your email address will not be published.

*

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

© 2014 Maria Naggaga

Theme by Anders NorenUp ↑

Floating Social Media Icons Powered by Acurax Blog Designing Company
More in Azure, Web (4 of 5 articles)

Visit Us On TwitterVisit Us On LinkedinVisit Us On Google Plus