gpt4 book ai didi

mysql - mysql 中的数据库名称似乎有效,但显示错误

转载 作者:行者123 更新时间:2023-11-29 13:54:20 26 4
gpt4 key购买 nike

我正在尝试创建一个在两个单词之间带有“-”的数据库,它应该可以正常工作,但事实并非如此。这是日志文件:

mysql> create database test1;
Query OK, 1 row affected (0.00 sec)

mysql> show databases
-> ;
+-----------------------+
| Database |
+-----------------------+
| information_schema |
| mifos |
| mifosplatform_tenants |
| mifostenant |
| mifostenant_default |
| mysql |
| performance_schema |
| sakila |
| test |
| test1 |
| testing |
| world |
+-----------------------+
12 rows in set (0.00 sec)

mysql> create database test1-mohit;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '-mohi
t' at line 1

最佳答案

您可以使用_(下划线)

create database test1_mohit;

或者试试这个

  create database `test1_mohit`;

这两个都可以

关于mysql - mysql 中的数据库名称似乎有效,但显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16116406/

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