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.
/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
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
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):