MySQL in-app on Azure for Magento

i have been using Azure for all my hosting and databases etc. Lately Azure has taken out this MySQL in-app. Now i wanted to make a Magento website, but it was there in "web app" and now its gone. The problem is i have no idea how to connect the magento website to the mysql in-app? Can someone guide me as how should i fill this

I need these info from where do i get them

Any help will be highly appreciated. I just want to know how to connect Magento to the MySQL in-app

Upvotes: 0

Views: 541

Answers (1)

Aaron Chen
Aaron Chen

Reputation: 9950

First of all, you could use $_SERVER["MYSQLCONNSTR_localdb"] to get connection string via environment variable MYSQLCONNSTR_localdb.

The connection string looks something like:

Database=localdb;Data Source=127.0.0.1:54306;User Id=azure;Password=6#vWHD_$

Another option to get this string is that using the tool in SCM Kudu Console which could be accessed via https://<yourwebsitename>.scm.azurewebsites.net/DebugConsole. The credential is available at D:\home\data\mysql\MYSQLCONNSTR_localdb.txt.

After that, you will know how to fill Database Connection.

Beware that Azure is not using the default MySQL port (3306). In fact, the port number may vary for each application life cycle depending on its availability at startup time. So after Magento has been set up, you'll need to find out the database configuration file, then set the Host via environment variable like this:

array (  
    'host' => '127.0.0.1' . $_SERVER["WEBSITE_MYSQL_PORT"],
    'dbname' => 'localdb',
    'username' => 'azure',
    'password' => '6#vWHD_$',
    'active' => '1',
),

For more info, please refer to MySQL in app (preview).

Upvotes: 2

Related Questions