Wordpress on Azure can't make database connection
<p>I'm running Wordpress site on Azure. Site was up alright - slowly, but still. A few days ago it went down when my subscription limits kicked in. After the break I started both the site and database seemed to be working when looking from Azure management portal. But the site gives <em>Error establishing a database connection</em> -error. </p>

<p>What I've checked...</p>

<ul>
<li>Error comes from the frontend and from the backend (/wp_admin) </li>
<li>I've checked connection string about million times comparing connection string of the database from the Azure portal, values from the wp-config.php and values from the web app from the Azure portal</li>
</ul>

<p>I created a following test.php to try connection and making sure it is working. What's even more confusing, this code worked (with real values of course).</p>

<pre><code>&lt;?php
$host = "myhostname";
$user = 'myuser';
$password = 'mypassword';
$dbh = @mysql_connect($host, $user, $password);
if (!$dbh) {
    echo "Error establishing a database connection";
} else {
    echo "Database connection successful";
}
?&gt;
</code></pre>

<p>I'm not very experienced with Wordpress and I'm totally lost with this. I'm not sure if Azure is the right place to host Wordpress at all but I'd hate to start building my website again. </p>

<p>I found this very helpful post about issues with connections <a href="http://www.wpbeginner.com/wp-tutorials/how-to-fix-the-error-establishing-a-database-connection-in-wordpress/" rel="nofollow">http://www.wpbeginner.com/wp-tutorials/how-to-fix-the-error-establishing-a-database-connection-in-wordpress/</a> but it didn't help me either. </p>

<p>Any ideas?</p>