Categories
azure mysql pdo php wordpress

Azure: Where is default user/pass for WordPress database using MySQL in-app(preview)?

I just started an Azure hosted WordPress App Service and chose to do the MySQL in-app(preview) option for the database. For those that aren’t aware, this allows me to run the MySQL server side-by-side with my Web application within the same environment.

However, I’m running into a problem with the way I am choosing to make MySQL queries.

I want to reuse code from a different PHP project where the MySQL calls are in the form of PDO statements, like so:

try {
$db = new PDO('mysql:host=localhost;dbname=localdb;charset=utf8',
'user',
'pass');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch(PDOException $ex) {
echo "did not connect...";
}
$sth = $db->prepare("SELECT *FROM MyTable;");
$sth->execute();

I can’t make these calls unless I have a username and password to do so.

The PHPMyAdmin side-panel looks like this in the MySQL in-app(preview):

PHPMyAdmin side-panel for MySQL in-app preview

And if I pull up the user accounts, this is what I see:

PHPMyAdmin User Accounts

I’m lost when it comes to what user and pass I should use, and if I should even be using localdb as my db (that’s where all the wordpress tables are listed).

All in all, I’m just trying to pull information from the database using PDO statements and need to know how to go about it.