简体   繁体   中英

Base Table or View not found:1146 in symfony3

So I had some issues with my PC few days ago . I used the Sytem Restore to fix them.

Everything is ok now, but I have some issues with my symfony project.

Indeed, some tables don't seem to "exist" anymore for symfony , and others are working perfectly.

I don't know why, but when I want to persist or use these tables I have this error :

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

The Entity is still there and I can found the corrupted tables on mysql . How to fix it ? thanks

错误2

在此处输入图片说明

Do these tables are listed in information_schema ? I doubt they disappeared from it, but we never know / you can check that with this query :

SELECT table_name FROM INFORMATION_SCHEMA.TABLES;

You should also give a try to repair methods listed on this page . Is the symfony mysql user in parameters the same than the one you use to access them from your GUI ? If not, have a look at your permissions too for the Symfony User.

Dumping your database and importing it again should do the job in my opinion.

Yo I know how to fix this issue now .

This solution apply for those who are using symfony 3 (framework).

First you need to delete your table in mysql with this command (database = symfony) .

DROP TABLE yourtablename;

Now re-generate your entities again via this command

php bin/console generate:doctrine:entities YourBundleNameBundle

Update your entities schema on mysql

php bin/console doctrine:schema:update --dump -sql

Now force the Schema and your tables should be back again

php bin/console doctrine:schema:update --force

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM