Base table or view not found: 1146 Table SQLSTATE[42S02]: doesn't existMagento 2 Database table not creatingMagento 2 Error: Base table or view not found: 1146 Table 'dbname.catalog_category_flat_store_1' doesn't existSQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.design_config_grid_flat' doesn't existError when editing products on Magento 2Magento 2 Integration test can't run - store_website doesn't existMagento2 Form Component Base Table not foundSQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2.catalog_product_entity_integer' doesn't existDatabase not updated with moduleDatabase rollback error in Magento 2.3Base table or view not exist

Complaints from (junior) developers against solution architects: how can we show the benefits of our work and improve relationships?

Patio gate not at right angle to the house

Did Vladimir Lenin have a cat?

Efficiently finding furthest two nodes in a graph

Are all French verb conjugation tenses and moods practical and efficient?

My employer is refusing to give me the pay that was advertised after an internal job move

Should I put my name first, or last in the team members list

Should I intervene when a colleague in a different department makes students run laps as part of their grade?

why there is no “error” term in survival analysis?

Why are subdominants unstable?

"DDoouubbllee ssppeeaakk!!"

Do professors like answering questions from non-students/private citizens?

Best Ergonomic Design for a handheld ranged weapon

Why does calling cout.operator<<(const char*) print the address instead of the character string?

Three Dots in Center Page

Rampant sharing of authorship among colleagues in the name of "collaboration". Is not taking part in it a death knell for a future in academia?

Is there a word or phrase that means 'works but not for the reason we expect it to'?

Why does the Rust compiler not optimize code assuming that two mutable references cannot alias?

What are the closest international airports in different countries?

How to efficiently shred a lot of cabbage?

How to prevent a single-element caster from being useless against immune foes?

Can living where Earth magnetic ore is abundant provide any protection?

How to foreshadow to avoid a 'deus ex machina'-construction

Unknown indication below upper stave



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


Magento 2 Database table not creatingMagento 2 Error: Base table or view not found: 1146 Table 'dbname.catalog_category_flat_store_1' doesn't existSQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.design_config_grid_flat' doesn't existError when editing products on Magento 2Magento 2 Integration test can't run - store_website doesn't existMagento2 Form Component Base Table not foundSQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2.catalog_product_entity_integer' doesn't existDatabase not updated with moduleDatabase rollback error in Magento 2.3Base table or view not exist






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















error: "Base table or view not found: 1146 Table"


when i run a collection query in my magento 2 application i get the above message.



The problem is that the table does indeed exist. however magento 2 appears to add the name of my 'database' to the main table name.This is why the query is unable to locate the table.




If i am correct, it means that i need to remove the automatic creation of a table prefix by magento




This is the collection query:



$accountTypesCollection = $this->_modelConstantAccounttypes->create();
$accountTypesCollection
->addFieldToFilter('brandId', 'barclays')
->addFieldToFilter('brandId', array('eq'=>'barclays'))
->addFieldToFilter('suppress', array('nlike' => '1'));
$accountTypesCollection->addAttributeToSort('priority');

echo $accountTypesCollection->getSelect();


This is the full print out of the select query:



SELECT `main_table`.* FROM `constants_account_types` AS `main_table` WHERE (`brandId` = 'barclays') AND (`brandId` = 'barclays') AND (`suppress` NOT LIKE '1') ORDER BY priority ASC


when i run this query directly into mysqlAdmin it returns the correct values.



so, i am unclear why magento adds the name of the database to the query.



this is the full error :



Base table or view not found: 1146 Table 'magentotwo.constants_account_types' doesn't exist, query was: SELECT `main_table`.* FROM `constants_account_types` AS `main_table` WHERE (`brandId` = 'barclays') AND (`brandId` = 'barclays') AND (`suppress` NOT LIKE '1') ORDER BY priority ASC


this is my database config file:



/<Magento Install Dir>/app/etc/env.php

'db' =>
array (
'table_prefix' => '',
'connection' =>
array (
'default' =>
array (
'host' => 'localhost',
'dbname' => 'magentotwo',
'username' => 'root',
'password' => '',
'active' => '1',
),
),
),


you can see that the table prefix column is left blank.










share|improve this question





















  • 1





    According to the error table constants_account_types is not available.

    – Sukumar Gorai
    Aug 20 '18 at 13:24











  • the table does indeed exist. i am able to run the query direct in mydqlAdmin

    – theSeeker
    Aug 20 '18 at 13:41











  • It happens when you create the table without prefix( while your DB tables have prefix), try with a prefix you have used for your DB creation time. Magento adding that prefix to your new table that doesn't have prefix.that's the issue.

    – Mahmood Rehman
    Jul 22 at 4:21

















2















error: "Base table or view not found: 1146 Table"


when i run a collection query in my magento 2 application i get the above message.



The problem is that the table does indeed exist. however magento 2 appears to add the name of my 'database' to the main table name.This is why the query is unable to locate the table.




If i am correct, it means that i need to remove the automatic creation of a table prefix by magento




This is the collection query:



$accountTypesCollection = $this->_modelConstantAccounttypes->create();
$accountTypesCollection
->addFieldToFilter('brandId', 'barclays')
->addFieldToFilter('brandId', array('eq'=>'barclays'))
->addFieldToFilter('suppress', array('nlike' => '1'));
$accountTypesCollection->addAttributeToSort('priority');

echo $accountTypesCollection->getSelect();


This is the full print out of the select query:



SELECT `main_table`.* FROM `constants_account_types` AS `main_table` WHERE (`brandId` = 'barclays') AND (`brandId` = 'barclays') AND (`suppress` NOT LIKE '1') ORDER BY priority ASC


when i run this query directly into mysqlAdmin it returns the correct values.



so, i am unclear why magento adds the name of the database to the query.



this is the full error :



Base table or view not found: 1146 Table 'magentotwo.constants_account_types' doesn't exist, query was: SELECT `main_table`.* FROM `constants_account_types` AS `main_table` WHERE (`brandId` = 'barclays') AND (`brandId` = 'barclays') AND (`suppress` NOT LIKE '1') ORDER BY priority ASC


this is my database config file:



/<Magento Install Dir>/app/etc/env.php

'db' =>
array (
'table_prefix' => '',
'connection' =>
array (
'default' =>
array (
'host' => 'localhost',
'dbname' => 'magentotwo',
'username' => 'root',
'password' => '',
'active' => '1',
),
),
),


you can see that the table prefix column is left blank.










share|improve this question





















  • 1





    According to the error table constants_account_types is not available.

    – Sukumar Gorai
    Aug 20 '18 at 13:24











  • the table does indeed exist. i am able to run the query direct in mydqlAdmin

    – theSeeker
    Aug 20 '18 at 13:41











  • It happens when you create the table without prefix( while your DB tables have prefix), try with a prefix you have used for your DB creation time. Magento adding that prefix to your new table that doesn't have prefix.that's the issue.

    – Mahmood Rehman
    Jul 22 at 4:21













2












2








2








error: "Base table or view not found: 1146 Table"


when i run a collection query in my magento 2 application i get the above message.



The problem is that the table does indeed exist. however magento 2 appears to add the name of my 'database' to the main table name.This is why the query is unable to locate the table.




If i am correct, it means that i need to remove the automatic creation of a table prefix by magento




This is the collection query:



$accountTypesCollection = $this->_modelConstantAccounttypes->create();
$accountTypesCollection
->addFieldToFilter('brandId', 'barclays')
->addFieldToFilter('brandId', array('eq'=>'barclays'))
->addFieldToFilter('suppress', array('nlike' => '1'));
$accountTypesCollection->addAttributeToSort('priority');

echo $accountTypesCollection->getSelect();


This is the full print out of the select query:



SELECT `main_table`.* FROM `constants_account_types` AS `main_table` WHERE (`brandId` = 'barclays') AND (`brandId` = 'barclays') AND (`suppress` NOT LIKE '1') ORDER BY priority ASC


when i run this query directly into mysqlAdmin it returns the correct values.



so, i am unclear why magento adds the name of the database to the query.



this is the full error :



Base table or view not found: 1146 Table 'magentotwo.constants_account_types' doesn't exist, query was: SELECT `main_table`.* FROM `constants_account_types` AS `main_table` WHERE (`brandId` = 'barclays') AND (`brandId` = 'barclays') AND (`suppress` NOT LIKE '1') ORDER BY priority ASC


this is my database config file:



/<Magento Install Dir>/app/etc/env.php

'db' =>
array (
'table_prefix' => '',
'connection' =>
array (
'default' =>
array (
'host' => 'localhost',
'dbname' => 'magentotwo',
'username' => 'root',
'password' => '',
'active' => '1',
),
),
),


you can see that the table prefix column is left blank.










share|improve this question
















error: "Base table or view not found: 1146 Table"


when i run a collection query in my magento 2 application i get the above message.



The problem is that the table does indeed exist. however magento 2 appears to add the name of my 'database' to the main table name.This is why the query is unable to locate the table.




If i am correct, it means that i need to remove the automatic creation of a table prefix by magento




This is the collection query:



$accountTypesCollection = $this->_modelConstantAccounttypes->create();
$accountTypesCollection
->addFieldToFilter('brandId', 'barclays')
->addFieldToFilter('brandId', array('eq'=>'barclays'))
->addFieldToFilter('suppress', array('nlike' => '1'));
$accountTypesCollection->addAttributeToSort('priority');

echo $accountTypesCollection->getSelect();


This is the full print out of the select query:



SELECT `main_table`.* FROM `constants_account_types` AS `main_table` WHERE (`brandId` = 'barclays') AND (`brandId` = 'barclays') AND (`suppress` NOT LIKE '1') ORDER BY priority ASC


when i run this query directly into mysqlAdmin it returns the correct values.



so, i am unclear why magento adds the name of the database to the query.



this is the full error :



Base table or view not found: 1146 Table 'magentotwo.constants_account_types' doesn't exist, query was: SELECT `main_table`.* FROM `constants_account_types` AS `main_table` WHERE (`brandId` = 'barclays') AND (`brandId` = 'barclays') AND (`suppress` NOT LIKE '1') ORDER BY priority ASC


this is my database config file:



/<Magento Install Dir>/app/etc/env.php

'db' =>
array (
'table_prefix' => '',
'connection' =>
array (
'default' =>
array (
'host' => 'localhost',
'dbname' => 'magentotwo',
'username' => 'root',
'password' => '',
'active' => '1',
),
),
),


you can see that the table prefix column is left blank.







magento2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 20 '18 at 13:53







theSeeker

















asked Aug 20 '18 at 13:18









theSeekertheSeeker

1198 bronze badges




1198 bronze badges










  • 1





    According to the error table constants_account_types is not available.

    – Sukumar Gorai
    Aug 20 '18 at 13:24











  • the table does indeed exist. i am able to run the query direct in mydqlAdmin

    – theSeeker
    Aug 20 '18 at 13:41











  • It happens when you create the table without prefix( while your DB tables have prefix), try with a prefix you have used for your DB creation time. Magento adding that prefix to your new table that doesn't have prefix.that's the issue.

    – Mahmood Rehman
    Jul 22 at 4:21












  • 1





    According to the error table constants_account_types is not available.

    – Sukumar Gorai
    Aug 20 '18 at 13:24











  • the table does indeed exist. i am able to run the query direct in mydqlAdmin

    – theSeeker
    Aug 20 '18 at 13:41











  • It happens when you create the table without prefix( while your DB tables have prefix), try with a prefix you have used for your DB creation time. Magento adding that prefix to your new table that doesn't have prefix.that's the issue.

    – Mahmood Rehman
    Jul 22 at 4:21







1




1





According to the error table constants_account_types is not available.

– Sukumar Gorai
Aug 20 '18 at 13:24





According to the error table constants_account_types is not available.

– Sukumar Gorai
Aug 20 '18 at 13:24













the table does indeed exist. i am able to run the query direct in mydqlAdmin

– theSeeker
Aug 20 '18 at 13:41





the table does indeed exist. i am able to run the query direct in mydqlAdmin

– theSeeker
Aug 20 '18 at 13:41













It happens when you create the table without prefix( while your DB tables have prefix), try with a prefix you have used for your DB creation time. Magento adding that prefix to your new table that doesn't have prefix.that's the issue.

– Mahmood Rehman
Jul 22 at 4:21





It happens when you create the table without prefix( while your DB tables have prefix), try with a prefix you have used for your DB creation time. Magento adding that prefix to your new table that doesn't have prefix.that's the issue.

– Mahmood Rehman
Jul 22 at 4:21










1 Answer
1






active

oldest

votes


















0














The constants_account_types table does not exist in magentotwo DataBase so either table not created or wrong DataBase configured in Magento.






share|improve this answer

























  • the table does exist. so it has to be the wrong Database configuration. How do you think i would go about debugging this

    – theSeeker
    Aug 20 '18 at 13:37











  • check dbname in app/etc/env.php file.

    – kunj
    Aug 20 '18 at 13:59











  • done. i have edited my original question to show that this is empty-- so, there is no reason why magento should be prefixing the query names with the name of my database table

    – theSeeker
    Aug 20 '18 at 14:01











  • so do you have correct DB and that table is exist in that DB, right?

    – kunj
    Aug 20 '18 at 14:05











  • yes.the database is correclty configured and the table does indeed exist. i beleive the error is caused beucase magento is incorrectly prefixing my table names with the word : magentotwo

    – theSeeker
    Aug 20 '18 at 14:13













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f238951%2fbase-table-or-view-not-found-1146-table-sqlstate42s02-doesnt-exist%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The constants_account_types table does not exist in magentotwo DataBase so either table not created or wrong DataBase configured in Magento.






share|improve this answer

























  • the table does exist. so it has to be the wrong Database configuration. How do you think i would go about debugging this

    – theSeeker
    Aug 20 '18 at 13:37











  • check dbname in app/etc/env.php file.

    – kunj
    Aug 20 '18 at 13:59











  • done. i have edited my original question to show that this is empty-- so, there is no reason why magento should be prefixing the query names with the name of my database table

    – theSeeker
    Aug 20 '18 at 14:01











  • so do you have correct DB and that table is exist in that DB, right?

    – kunj
    Aug 20 '18 at 14:05











  • yes.the database is correclty configured and the table does indeed exist. i beleive the error is caused beucase magento is incorrectly prefixing my table names with the word : magentotwo

    – theSeeker
    Aug 20 '18 at 14:13















0














The constants_account_types table does not exist in magentotwo DataBase so either table not created or wrong DataBase configured in Magento.






share|improve this answer

























  • the table does exist. so it has to be the wrong Database configuration. How do you think i would go about debugging this

    – theSeeker
    Aug 20 '18 at 13:37











  • check dbname in app/etc/env.php file.

    – kunj
    Aug 20 '18 at 13:59











  • done. i have edited my original question to show that this is empty-- so, there is no reason why magento should be prefixing the query names with the name of my database table

    – theSeeker
    Aug 20 '18 at 14:01











  • so do you have correct DB and that table is exist in that DB, right?

    – kunj
    Aug 20 '18 at 14:05











  • yes.the database is correclty configured and the table does indeed exist. i beleive the error is caused beucase magento is incorrectly prefixing my table names with the word : magentotwo

    – theSeeker
    Aug 20 '18 at 14:13













0












0








0







The constants_account_types table does not exist in magentotwo DataBase so either table not created or wrong DataBase configured in Magento.






share|improve this answer













The constants_account_types table does not exist in magentotwo DataBase so either table not created or wrong DataBase configured in Magento.







share|improve this answer












share|improve this answer



share|improve this answer










answered Aug 20 '18 at 13:30









kunjkunj

2,6922 gold badges5 silver badges23 bronze badges




2,6922 gold badges5 silver badges23 bronze badges















  • the table does exist. so it has to be the wrong Database configuration. How do you think i would go about debugging this

    – theSeeker
    Aug 20 '18 at 13:37











  • check dbname in app/etc/env.php file.

    – kunj
    Aug 20 '18 at 13:59











  • done. i have edited my original question to show that this is empty-- so, there is no reason why magento should be prefixing the query names with the name of my database table

    – theSeeker
    Aug 20 '18 at 14:01











  • so do you have correct DB and that table is exist in that DB, right?

    – kunj
    Aug 20 '18 at 14:05











  • yes.the database is correclty configured and the table does indeed exist. i beleive the error is caused beucase magento is incorrectly prefixing my table names with the word : magentotwo

    – theSeeker
    Aug 20 '18 at 14:13

















  • the table does exist. so it has to be the wrong Database configuration. How do you think i would go about debugging this

    – theSeeker
    Aug 20 '18 at 13:37











  • check dbname in app/etc/env.php file.

    – kunj
    Aug 20 '18 at 13:59











  • done. i have edited my original question to show that this is empty-- so, there is no reason why magento should be prefixing the query names with the name of my database table

    – theSeeker
    Aug 20 '18 at 14:01











  • so do you have correct DB and that table is exist in that DB, right?

    – kunj
    Aug 20 '18 at 14:05











  • yes.the database is correclty configured and the table does indeed exist. i beleive the error is caused beucase magento is incorrectly prefixing my table names with the word : magentotwo

    – theSeeker
    Aug 20 '18 at 14:13
















the table does exist. so it has to be the wrong Database configuration. How do you think i would go about debugging this

– theSeeker
Aug 20 '18 at 13:37





the table does exist. so it has to be the wrong Database configuration. How do you think i would go about debugging this

– theSeeker
Aug 20 '18 at 13:37













check dbname in app/etc/env.php file.

– kunj
Aug 20 '18 at 13:59





check dbname in app/etc/env.php file.

– kunj
Aug 20 '18 at 13:59













done. i have edited my original question to show that this is empty-- so, there is no reason why magento should be prefixing the query names with the name of my database table

– theSeeker
Aug 20 '18 at 14:01





done. i have edited my original question to show that this is empty-- so, there is no reason why magento should be prefixing the query names with the name of my database table

– theSeeker
Aug 20 '18 at 14:01













so do you have correct DB and that table is exist in that DB, right?

– kunj
Aug 20 '18 at 14:05





so do you have correct DB and that table is exist in that DB, right?

– kunj
Aug 20 '18 at 14:05













yes.the database is correclty configured and the table does indeed exist. i beleive the error is caused beucase magento is incorrectly prefixing my table names with the word : magentotwo

– theSeeker
Aug 20 '18 at 14:13





yes.the database is correclty configured and the table does indeed exist. i beleive the error is caused beucase magento is incorrectly prefixing my table names with the word : magentotwo

– theSeeker
Aug 20 '18 at 14:13

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f238951%2fbase-table-or-view-not-found-1146-table-sqlstate42s02-doesnt-exist%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form