Selecting a database in mysql with spaces in its name(在mysql中选择一个名称中带有空格的数据库)
问题描述
我想在 mysql 控制台中选择我的特定数据库,但问题是我的数据库名称之间有一个空格,mysql 忽略了空格后面的部分.例如,当我发出命令时:
I want to select my particular database in mysql console, but the problem is that my database name has a space in between and mysql ignores the part after the space. For instance, when i give the command:
use 'student registration'
我收到消息:
cannot find database 'student'
推荐答案
您应该尝试使用反引号 ("`") 来引用您的数据库名称.一般来说,最好使用命名约定来消除空格,例如
You should try using back ticks ("`") to quote your database name. Generally speaking, it's probably better to use a naming convention to eliminate white space, e.g.
USE `StudentRegistration`;
或
USE `student_registration`;
这篇关于在mysql中选择一个名称中带有空格的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在mysql中选择一个名称中带有空格的数据库


基础教程推荐
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01