0

I have created a custom module, but when I go to run php bin/magento setup:upgrade it fails and returns SQLSTATE[HY000] [1049] Unknown database 'magento'.

I have tried other stackover flow solutions to no avail. And I have uninstalled and reinstalled magento instances.

enter image description here

/app/etc.php

<?php
return [
    'backend' => [
        'frontName' => 'admin'
    ],
    'crypt' => [
        'key' => 'e6e76a3bc072a8ccf6c12282b78db401'
    ],
    'db' => [
        'table_prefix' => '',
        'connection' => [
            'default' => [
                'host' => 'localhost',
                'dbname' => 'magento',
                'username' => 'root',
                'password' => 'root',
                'active' => '1'
            ]
        ]
    ],
    'resource' => [
        'default_setup' => [
            'connection' => 'default'
        ]
    ],
    'x-frame-options' => 'SAMEORIGIN',
    'MAGE_MODE' => 'default',
    'session' => [
        'save' => 'files'
    ],
    'cache_types' => [
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'reflection' => 1,
        'db_ddl' => 1,
        'compiled_config' => 1,
        'eav' => 1,
        'customer_notification' => 1,
        'config_integration' => 1,
        'config_integration_api' => 1,
        'full_page' => 1,
        'config_webservice' => 1,
        'translate' => 1,
        'vertex' => 1
    ],
    'install' => [
        'date' => 'Fri, 22 Mar 2019 20:36:14 +0000'
    ]
];

2 Answers 2

1

Did you get it working?

From what I can see your .env is just referencing the wrong port number for mysql.

Try this (change the host to localhost:8889):

'default' => [
    'host' => 'localhost:8889',
    'dbname' => 'magento',
    'username' => 'root',
    'password' => 'root',
    'active' => '1'
]
Sign up to request clarification or add additional context in comments.

Comments

0

I ended up calling the command this by explicitly calling the path to my version of PHP: /Applications/MAMP/bin/php/php7.2.1/bin/php bin/magento setup:upgrade

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.