CREATE TABLE 后表不存在

2022-01-14 00:00:00 xampp mysql symfony mysql-error-1146

我正在尝试在我的数据库名称 symfony 中导入此 sql

I'm trying to import this sql in my database name symfony

CREATE TABLE IF NOT EXISTS ingredient (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

我明白了

#1146 - Table 'symfony.ingredient' doesn't exist

这似乎很奇怪,因为我在这里尝试创建这个表,所以......为什么它不起作用?如果我尝试,我会遇到同样的问题

This seems rather odd since i'm trying here to CREATE this table, so... why is it not working ? I've got the same problem if i try

CREATE TABLE symfony.ingredient

或者symfony 2中的特性

Or the feature in symfony 2

c:DevSymfony>php app/console doctrine:schema:create

PS:我只有新版本的xampp才有这个问题.

PS: I have this problem only with the new version of xampp.

编辑

嗯,我设法解决了我的问题.我删除了我的数据库,然后创建了一个(不是使用界面),最后我重新启动了 mysql 服务.我不知道为什么以及如何让我感到困惑,但我希望这会对某人有所帮助.

Well, i somehow managed to solve my problem. I dropped my database, then created one (not with the interface) and finally i restarded mysql service. I don't know why and how it unstuck me, but i hope this will help someone.

推荐答案

我也遇到了同样的问题.我的解决方案:在创建表查询中更改表名,执行它,然后重命名表.

I had the same problem. My solution: Change table name in the create table query, exequte it and then rename the table.

然后,您也可以删除此表并在创建它之后不会出错.

Then, you can also drop this table and after it create it without getting error.

相关文章