Search code examples
databaselaravelhost

database - Setting up laravel project (local) with database hosted in 000webhost


I have project on my local computer. I want to test my db online on 000webhost. I set .env file like this

.env

and I had error like this

error

thanks before


Solution

  • If your database is hosted on an external server / hosting service (e.g. 000webhost) then your database DB_HOST in .env won't be "localhost", it would be something like this:

    mysql#.000webhost.com
    

    Where the # is number of the allocated database server for your site.

    Typically, when you create a new database, they show the database access details, use those details.