简体   繁体   English

我正在尝试删除MySQL数据库,但在控制台中显示错误

[英]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.

相关问题 当我尝试删除数据库并使用mysql作为metastore时,为什么Hive会给出metaexception? - why is Hive giving metaexception when i am trying drop database and i am using mysql as metastore? 我正在尝试从 phpmyadmin 数据库中获取信息,但在浏览器中显示无法获取/员工,并且在命令提示符下没有错误 - I am trying to fetch information from phpmyadmin database, but in browser it's showing cannot get/employee and in command prompt there is no error 我正在尝试使用休眠xml映射连接到mysql数据库,但出现此错误 - I am trying to connect to a mysql database with hibernate xml mapping but I am getting this error 我正在尝试将图像保存在mySQL数据库中,但收到一个错误,该错误为null - I am trying to save an image in a mySQL database but I am recieveing a error that it is null 我正在尝试使用 shell 脚本更改 MYSQL 8.0 密码,但它显示此错误 - I am trying to change MYSQL 8.0 password using a shell script but its showing this error 我究竟做错了什么? 尝试使用 PySpark 连接到 mySql 数据库,但我一直收到加载错误 - What am I doing wrong? Trying to use PySpark to connect to mySql database but I keep receiving load error 我是PHP + MySql的新手,并尝试编写一个简单的脚本从数据库中删除用户,但是我没有摆脱错误 - I am new to PHP+MySql,and trying to write a simple script that will delete a user from the database,,but i am not getting rid of a error 我正在尝试安装 mysql2 gem 来使用 ruby 导航数据库,它给了我一个错误。 Windows - I am trying to install mysql2 gem to navigate db's with ruby and it gave me an error. Windows 如何删除我在 mysql 中的数据库? 不知道数据库名称 DROP DATABASE() - how can i delete the database that i am in it in mysql? without knowing the name of the database DROP DATABASE() 尝试从 MySql 中的数据库检索数据时出现“java.lang.ClassNotFoundException: com.mysql.jdbc.Driver”错误 - I am getting " java.lang.ClassNotFoundException: com.mysql.jdbc.Driver " error while trying to retrieve data from the database in MySql
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM