Reputation: 2287
I've tried to host the Laravel 5 web app by following this tutorial,
It successes and I can access my web apps URL, but I cannot access some elements of my web apps because some of them need database.
Before hosting it, I've test the web apps using xampp
, localhost
& mySQL
, and it works perfectly by using the ability from Laravel5
to migrate the database to mySQL(xampp)
My question is, how to configure the database in azure so it will work with our web apps? I've heard that some people telling about the .env file, but I don't know what to do with it to make the database works. Thanks.
Upvotes: 1
Views: 2326
Reputation: 13918
ClearDB provides MySQL database Services in Azure, you can leverage it to create and host your MySQL database, then set the MySQL connection info in your laravel application configuration files.
You can follow the steps below to create a MySQL database on Azure:
Fill the basic information of your MySQL database:
config/database.php
:
'mysql' => array(
'driver' => 'mysql',
'host' => 'xx-xxxx-azure-xxxx-c.cloudapp.net',
'database' => '<your_database_name>',
'username' => '<your_user_name>',
'password' => '<your_password>',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
And the database setting should be modified in .env file as well.Additionally, you can leverage your MySQL workbench to connect to MySQL database on Azure to manage your data.
Upvotes: 3