gpt4 book ai didi

mysql - 在 Mysql 数据库中删除搞砸的表

转载 作者:可可西里 更新时间:2023-11-01 06:33:14 25 4
gpt4 key购买 nike

我设法破坏了(或其他)我拥有的 mysql 数据库中的“ session ”表(称为“e_learning_resource_prelive”)。这通常不是问题,因为我可以返回到数据库的备份转储。但是,损坏的表似乎阻止了我删除数据库:

> mysqladmin -u root drop e_learning_resource_prelive
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.

Do you really want to drop the 'e_learning_resource_prelive' database [y/N] y
mysqladmin: DROP DATABASE e_learning_resource_prelive failed;
error: 'Unknown table 'sessions''

当我进入数据库时​​, session 表显示在 show_tables 中(它是那里唯一的一个,mysqladmin drop 删除了其余的)但我不能删除它:

mysql> show tables;
+---------------------------------------+
| Tables_in_e_learning_resource_prelive |
+---------------------------------------+
| sessions |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> drop table sessions;
ERROR 1051 (42S02): Unknown table 'sessions'

谁能告诉我如何删除这个表或整个数据库?我需要删除数据库,然后从我的备份转储中重建它。

最佳答案

想通了,现在看起来有点明显了。 dbs 都只有一个文件夹,可以像其他任何东西一样删除。

sudo rm -r/var/lib/mysql/e_learning_resource_prelive

无论如何,感谢所有看过的人 :)最大

关于mysql - 在 Mysql 数据库中删除搞砸的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2008628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com