Support the ongoing development of →
Installation Configuration Database
Last updated 1 year ago.

try the obligatory localhost or instead of that? worth a shot if anything..


Mysql isn't running on the localhost, app and database are hosted on separate hosts.


can you connect from the command line with the info from the .env to the DB server? Is there anything set in the config/database?


from command line it connects fine, running the command php artisan migrate --seed works great

although php artisan migrate:refresh -seed returns an exception, it doesn't seem to find the migration php files (¿?)

in config/database.php there is this:

	'fetch' => PDO::FETCH_ASSOC,

	'default' => env('DB_CONNECTION', 'mysql'),

	'connections' => [

		'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', ''),
            'database'  => env('DB_DATABASE', 'database'),
            'username'  => env('DB_USERNAME', 'user'),
            'password'  => env('DB_PASSWORD', 'password'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,

Last updated 8 years ago.

Did you ever get this figured out? I'm having the exact same issue when moving my project from local dev to dev server. Can migrate, can interact with models in artisan tinker, but can't use a model from any controller or route without a PDO exception, and I had to wrap it in a try/catch to be able to see that much...


Sign in to participate in this thread!


Your banner here too?

dieg0 dieg0 Joined 30 May 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.