[英]I am trying to drop MySQL database but it's showing an error in console
In console I am trying to drop database using command 在控制台中,我尝试使用命令删除数据库
drop database database_name;
But it's throwing the below error. 但这会引发以下错误。
ERROR 1064 (42000): You have an error in your SQL syntax; 错误1064(42000):您的SQL语法有错误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database check' at line 1 检查与您的MySQL服务器版本相对应的手册,以在第1行的“数据库检查”附近使用正确的语法
I also tried to use another command: 我也尝试使用另一个命令:
mysqladmin -u root -p drop check;
It is throwing an error below 它在下面抛出错误
ERROR 1064 (42000): You have an error in your SQL syntax; 错误1064(42000):您的SQL语法有错误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqladmin -u root -p drop check' at line 1 检查与您的MySQL服务器版本相对应的手册,以在第1行的'mysqladmin -u root -p drop check'附近使用正确的语法
How to fix it? 如何解决?
CHECK
is a reserved word in MySQL, you should use back-tick character to escape it: CHECK
是MySQL中的保留字,您应使用反引号将其转义:
DROP DATABASE `check`;
In future, try to avoid using reserved words as names of tables/databases to prevent such things from happening. 将来,请尝试避免将保留字用作表/数据库的名称,以防止发生此类情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.