Support the ongoing development of Laravel.io →
Installation Configuration Database
Last updated 2 years ago.
0

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

0

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

0

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?

0

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', '10.1.220.251'),
            '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 9 years ago.
0

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...

0

Sign in to participate in this thread!

Eventy

Your banner here too?

dieg0 dieg0 Joined 30 May 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.