5

Trying to reinstall Magento in cli.

Run this command

php -d memory_limit=-1 bin/magento setup:install \
--base-url=http://local/ \
--db-host=localhost --db-name=magento \
--db-user=root --db-password=root \
--admin-firstname=Admin --admin-lastname=Adminovich --admin-email=admin@example.com \
--admin-user=admin --admin-password=qwerty --language=de_DE \
--currency=EUR --timezone=Europe/Kiev \
--cleanup-database

And got

[Zend_Db_Statement_Exception]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.store_website' doesn't exist, query was: SELECT `main_table`.* FROM `store_website` AS `main_table` ORDER BY main_table.sort_order ASC, main_table.name ASC

[PDOException]                                                                                    
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.store_website' doesn't exist

Need some help, thanks for response

  • Create a new database ands try again .php -d memory_limit=10G bin/magento setup:install --base-url=http://127.0.0.1/magento2git/ --db-host=localhost --db-name=magento2git --db-user=root --db-password=admin#123 --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 changes database and other parameters from here – Amit Bera Apr 4 '18 at 8:05
  • @AmitBera I have created new database and got same error. – hesoy Apr 4 '18 at 11:39
7

If you are trying to install it over the same installation please try to uninstall it first. As seen on magento official docs:

/magento_root/bin/magento setup:uninstall

Then run your command again.

If this fails again then drop your database and re-run your commands as @Amit Bera already said.

  • trying to uninstall and got error 'Starting Magento uninstallation: Can't clear cache due to the following error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'core_config_data' doesn't exist, query was: SELECT main_table.* FROM core_config_data AS main_table To fully clean up your uninstallation, you must manually clear your cache.' I have removed all from 'var'. – hesoy Apr 4 '18 at 11:37
  • I think it was a fault that i didn't uninstall magento firstly. – hesoy Apr 4 '18 at 11:43
  • If you haven't dropped your db yet try out /magento_root/bin/magento cache:clean and then the rest of the process. – 1337_sanc Apr 4 '18 at 12:00
  • I have re-cloned my project, drop database and got similar error. Trying to install from web interface and didn't got error. – hesoy Apr 4 '18 at 12:51
2

Deleting /app/etc/env.php fixes the problem. It will be regenerated by the bin/magento setup:install command.

0

I forgot to uninstall magento first. Cleared generated files (env.php and etc) and DB, then setup:install.

0

I found out the reason of this error. Some extensions add custom CLI commands. Check di.xml for:

Magento\Framework\Console\CommandListInterface
Magento\Framework\Console\CommandList

The problem is these commands include classes that require data in tables. But you didn't installed the system. For example, if you try to include Magento\Framework\Stdlib\DateTime\TimezoneInterface in your command class you will get error like:

Base table or view not found: 1146 Table 'magento.store_website' doesn't exist, query was: SELECT `store_website`.* FROM `store_website` - skipping database cleanup

Try to remove custom extensions before an installation.

P.S. Tested on Magento 2.3.1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.