-edit- OMG小马回答正确。我不能接受他的回答,因为现在只是一个注释。
-edit- OMG Ponies answered this correctly. I cant accept his answer because for now it is just a comment.
我建议这样做
SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema = 'mydb' AND table_name='ApprovePost';但这不可靠,导致我在windows和linux上的几个版本的mysql的错误。
也许有其他方式。有人知道吗?
Maybe there is another way. Does anyone know?
这个问题是我可以做创建表如果不存在,但我做第二次传递添加FK约束。在我的sql转储我看到> 130包含在一个单一的表。该表只有6列,其中只有两个需要约束。
This issue is i can do create table if not exists but i do a second pass to add the FK constraint. In my sql dump i see > 130 contains on a single table. The table only has 6 columns, only two of these need constrains. The constrains keep building and building everytime i restart the apache server or whenever mono feels the need to call my global init method in my webapp.
推荐答案每当我重新启动apache服务器或每当mono需要在我的webapp中调用我的全局init方法时,约束就会继续构建和构建。
看起来您需要使用 FLUSH TABLES 命令来输入INFORMATION_SCHEMA.TABLES以反映现有表格。
Looks like you need to use the FLUSH TABLES command for the INFORMATION_SCHEMA.TABLES to reflect existing tables.
参考:
- TABLE CACHE
- TABLE CACHE
更多推荐
如何检测表是否存在? MySql
发布评论