clean-docker / Magento2

Docker Image to Magento 2 local development in Mac, Linux and Windows
https://hub.docker.com/r/rafaelcgstz/magento2/
MIT License
444 stars 251 forks source link

SQLSTATE[HY000] [1045] Access denied for user 'magento'@'172.20.0.7' (using password: YES) #42

Closed duytran21 closed 6 years ago

duytran21 commented 6 years ago

After I do install-magento2 It gives me this error. Do you know how to fix it? I'm newbie in magento and docker

Thanks

duytran21 commented 6 years ago

I fixed this error by removing MySQL and reinstalling all container. But now I have some other errors

  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  There are no commands defined in the "indexer" namespace.

  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  There are no commands defined in the "deploy:mode" namespace.

so when I type localhost in the browser it says: An error has happened during the application run. See exception log for details.

Here is exception log file:

[2018-03-02 21:21:48] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:21:59] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:22:04] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:22:58] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:23:00] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:23:04] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:24:38] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:24:41] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:29:00] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:29:02] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:29:06] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:29:18] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:29:21] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:30:24] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []
[2018-03-02 21:30:28] main.CRITICAL: Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/html/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/html/vendor/magento/framework/App/ErrorHandler.php:61)"} []

Any ideas?

rafaelstz commented 6 years ago

Hi @duytran21, you can run these commands below after running the commands ./shell to access your container:

composer install
chmod u+x ./bin/magento
n98 db:drop && n98 db:create && rm app/etc/env.php
n98 setup:install --base-url=http://localhost/ \
    --db-host=db \
    --db-name=magento \
    --db-user=root \
    --db-password=root \
    --admin-firstname=Magento \
    --admin-lastname=Commerce \
    --admin-email=user@example.com \
    --admin-user=admin \
    --admin-password=admin123 \
    --language=en_US \
    --currency=USD \
    --timezone=America/Chicago \
    --use-rewrites=1 \
    --backend-frontname=admin \
    --use-sample-data \
&& n98 sampledata:deploy \
&& n98 setup:upgrade \
&& n98 indexer:reindex \
&& n98 cache:flush;
mv package.json.sample package.json ; mv Gruntfile.js.sample Gruntfile.js;
npm i;
n98 deploy:mode:set developer;

What's your OS? have you specified some version when install using install-magento2?

duytran21 commented 6 years ago

I'm using Mac High Sierra now. Yes, I did install-magento2 2.2.3

rafaelstz commented 6 years ago

@duytran21 Is it working after run the code snippets above?

duytran21 commented 6 years ago

Thank you for your response. I don't use docker to install magento anymore. I built it on cloud server. Anyway thanks again. I really appreciate it.