Laravel - create & deploy the project on MDB GO

How to deploy & host Laravel app - tutorial & free hosting

This guide will show you how to create and publish Laravel project and MySQL database with MDB GO.


Initialize Laravel project

We will go through the following steps:

  • Create a MySQL database named todo_app
  • Create Laravel project

Let's go!

Creating MySQL database

In order to create a new database you need to run the following command:

        
            
            $ mdb database init -db mysql8
          
        
    

Now you need to provide your user data and then the database details. Please provide the values of your choice. For example:

? Enter username thor
? Enter password Mjolnir_1
? Repeat password Mjolnir_1
? Enter database name todo_app
? Enter description Database for the TODO app

Note: the password must contain at least one uppercase letter, one lowercase letter, one number, one special symbol and have minimum length of 8.

Hit Enter and it's done.

Please notice that in the command output the username and database name slightly differs from what you provided earlier. Don't worry - it's OK. A few random characters have been added to these values to randomize them and improve security of your database credentials.

Important: Do not close your terminal window until you save your credentials somewhere. This is the only time we will show you your database password. If you don't save it you'll lose it.

Creating Laravel project

In order to initialize and use predefined Laravel starter run the following command:

        
            
                  $ mdb backend init
              
        
    

and choose Laravel starter from the list that shows up.

After initialization just go to the newly created project directory and open the .env file. After that edit the config values that start with DB_. You should make use of credentials that's been shown to you in the previous step. In my case the updated values look like this:

DB_CONNECTION=mysql
DB_HOST=mysql.db.mdbgo.com
DB_PORT=3306
DB_DATABASE=todo_app48a0ca47
DB_USERNAME=thor83ad51bf
DB_PASSWORD=Mjolnir_1

The starter project is ready to use. You don't have to change anything to run the example app for the sake of this tutorial. Simply publish it using the following command:

        
            
            $ mdb publish -p php-laravel
          
        
    

After your files get uploaded you can access your app under the address shown in the output.

Note: You may want to check the tutorial where we explain in detail what can go wrong here and how to deal with it.

Note: Since we need to install dependencies and run your app, it may take a few moments until it will be available under the provided URL.