cancel
Showing results for 
Search instead for 
Did you mean: 

Running Setup:Upgrade, SQLSTATE[42S02]: Base table or view not found:

Running Setup:Upgrade, SQLSTATE[42S02]: Base table or view not found:

Hi All, relative new to Magento. Currently I am trying to register a custom module and running;

php bin/magento setup:upgrade

 

However I am getting the error SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2.core_config_data' doesn't exist, query was: SELECT `main_table`.* FROM `core_config_data` AS `main_table`

 

I believe it maybe because I am have a Brew MySQL installed and a MAMP MySQL installed. 

 

FYI; I installed Magento2 within MAMP, on a MacOS, I have checked the table/database on the env.php file and via phpmyadmin and it all seems correct. 

 

 

6 REPLIES 6

Re: Running Setup:Upgrade, SQLSTATE[42S02]: Base table or view not found:

Hello @jchan1993h4a40 

I think there is some miss match between your MAMP and Brew Mysql.

 

You can find out like this

> Open Terminal

> Run below command 

mysql -uroot -p (Press Enter)
asking you password of the mysql .Please add it and press enter

> show databases;

 

If everything okay then please remove anyone mysql.

 

If my answer is useful, please Accept as Solution & give Kudos

Thank you
Anant Prajapati
Magento Certified Developer

Re: Running Setup:Upgrade, SQLSTATE[42S02]: Base table or view not found:

Hi, thanks for this. However I only have one MySQL when I run that command - is this right?

Re: Running Setup:Upgrade, SQLSTATE[42S02]: Base table or view not found:

if you have one than Please make sure to check credential

Thank you
Anant Prajapati
Magento Certified Developer

Re: Running Setup:Upgrade, SQLSTATE[42S02]: Base table or view not found:

@anantprajapati Weird, I have checked the credentials - which is the right credentials for the database I need within MAMP/PHPmyadmin. However, when I run bin/magento setup:upgrade, this is detecting the database within brew (as it has no tables but also when I delete it then it does not find it). 

Re: Running Setup:Upgrade, SQLSTATE[42S02]: Base table or view not found:

Hello @jchan1993h4a40 

Can you please check this thread. May be it will useful for you.

https://stackoverflow.com/questions/43283899/will-the-mamppro-mysql-conflict-with-brew-install-mysql... 

 

I think you should use the port number with the host.

 

If my answer is useful, please Accept as Solution & give Kudos

Thank you
Anant Prajapati
Magento Certified Developer

Re: Running Setup:Upgrade, SQLSTATE[42S02]: Base table or view not found:

Hello @jchan1993h4a40 

 

Please check on database first if the table exists and we can add prefix for all tables of Magento for more integrity, check env.php there must be some pre-fix added because you're not facing any issue with Magento running, right ?

so the new module doesn't know about this and maybe using the table name without prefix.

if so, please contact your Developers or Support team of module to correct query.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy