删除字符为“?”的数据库 在其名称中,您需要在数据库名称周围使用反引号。语法如下-
DROP DATABASE `yourDatabaseName`;
为了理解上述语法,让我们创建一个数据库。创建数据库的查询如下-
mysql> create database `test?data`;
那么,我有一个数据库吗?字符。显示所有数据库的查询如下-
mysql> show databases;
以下是输出-
+-----------------------+ | Database | +-----------------------+ | business | | commandline | | database1 | | databasesample | | education | | hb_student_tracker | | hello | | information_schema | | javadatabase2 | | javasampledatabase | | mybusiness | | mydatabase | | mysql | | onetomanyrelationship | | performance_schema | | rdb | | sample | | sampledatabase | | schemasample | | sys | | test | | test3 | | test?data | | universitydatabase | | web | | webtracker | +-----------------------+ 26 rows in set (0.09 sec)
要删除数据库吗?字符,则需要在数据库名称周围使用反引号。查询如下-
mysql> drop database `test?data`;
现在,您可以检查是否没有带有test?data的数据库。查询如下-
mysql> show databases;
以下是输出-
+-----------------------+ | Database | +-----------------------+ | business | | commandline | | database1 | | databasesample | | education | | hb_student_tracker | | hello | | information_schema | | javadatabase2 | | javasampledatabase | | mybusiness | | mydatabase | | mysql | | onetomanyrelationship | | performance_schema | | rdb | | sample | | sampledatabase | | schemasample | | sys | | test | | test3 | | universitydatabase | | web | | webtracker | +-----------------------+ 25 rows in set (0.00 sec)
查看上面的输出,没有名称为test?data的数据库;