So the error says you are using wrong username or password?
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost'
I am getting SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' error while running composer update command. My .env file settings is like below.
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=wolf DB_USERNAME=root DB_PASSWORD=root
I am getting below error.
@Sinnbeck Thanks. But I put correct uesrname & password.
@afoysal Clearly you didn’t, because as you can see in your screenshot, it’s trying to connect WITHOUT a password.
Also, it’s not composer update that’s causing the error (that doesn’t access your Laravel database). It’s Laravel’s ‘discover packages’ script that is set to run after Composer’s update script.
If you don’t need the package discovery script – and often you don’t actually – you can just remove it from your composer.json file.
@kokoshneta Thanks. How can I remove it from composer ? Should I remove it from here ? "scripts": { "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] }
Is your config cached?
php artisan cache:clear
@tykus Thanks. I am getting this error. https://i.stack.imgur.com/PqYzl.png
@afoysal you are probably making a database call in a ServiceProvider (which calls to your helpers file on line 183) - if you can wrap whatever that code is like this:
if (!app()->runningInConsole()) {
// make the query
}
then you should be able to clear the incorrect cache
@tykus Thanks. Did you check my screenshot properly ?
@Sinnbeck Thanks . But I couldn't find that ServiceProvider. That's why I asked that. Thanks.
@afoysal Well you can open the helpers file and instead check on line 183. That is doing a database call which is being run on every single request (and cli call)
@Sinnbeck Thanks. But now I am getting another error. https://i.stack.imgur.com/PmTsb.png
@afoysal maybe you don't understand the meaning of probably? Anyway, I told you where to look and what to do as mitigation, so good luck with that 👍
@tykus Thanks. But now I am getting another error. https://i.stack.imgur.com/PmTsb.png
@afoysal So look on line 32 in your AppServiceProvider as the error message is telling you to…
@afoysal are we to direct you through every line in the stacktrace?
Are you using MAMP? Please confirm you are using the correct port.
Is 3306 the correct port?
In case of MAMP its 8889
Please or to participate in this conversation.