I'm using Laravel 4.2 and I'm usinh ssh to log into server. I'm trying to make anew migration and I ran:
php artisan make:migration create_logs_table --create=logs
but i'm getting this error:
{"error":{"type":"PDOException","message":"SQLSTATE[28000] [1045] Access denied for user 'myproject'@'localhost' (using password: YES)","file":"\\/home\\/public_html\\/myproject\\/vendor\\/laravel\\/framework\\/src\\/Illuminate\\/Database\\/Connectors\\/Connector.php","line":47}}
I haven't changed my env file - database, username and password are still the same. When I use command line and try to create a new migration, I got this error. Why I get this error for user myproject
-> my username is another - this is the name of the project.
Thanks!
Well CLI in Laravel 4 can be tricky. Despite of .env file you could also have different enviroment in web and in CLI set.
So... first of all if you have for example local enviroment - in the .env
file:
export APP_ENV=local
but this is not enough. You have to open your bootstrap/start.php
file and set your machine to specify enviroment:
$env = $app->detectEnvironment(function() use ($app){
$env = array_get($_SERVER, 'APP_ENV');
if(empty($env)){
$envs = [
'local' => ['your_machine_name'],
];
$env = $app->detectEnvironment($envs);
}
return $env;
});
Be sure that you have this all set and you're working on good enviroment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.