当我以root身份运行mysql并运行SHOW DATABASES;
时,它显示我有一个one_db
数据库,但是当我运行DROP DATABASE one_db;
时,它会输出以下错误:
ERROR 1008 (HY000): Can't drop database 'one_db'; database doesn't exist
然后我尝试CREATE DATABASE one_db;
并输出此错误:
ERROR 1007 (HY000): Can't create database 'one_db'; database exists
如何立即删除此数据库?
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| one_db |
+--------------------+
4 rows in set (0.00 sec)
mysql> DROP DATABASE one_db;
ERROR 1008 (HY000): Can't drop database 'one_db'; database doesn't exist
mysql> CREATE DATABASE one_db;
ERROR 1007 (HY000): Can't create database 'one_db'; database exists
答案 0 :(得分:9)
要修复,可以手动清理与one_db
数据库相关的mysql文件:
手动清理流程
通过运行(在mysql shell上)找到mysql的datadir路径:
show variables where Variable_name ='datadir';
停止mysql服务器
- 下的one_db目录
删除'datadir'
- 醇>
重启mysql服务器并验证数据库one_db不存在