数据库use命令_使用USE命令切换数据库

数据库use命令

Creating a database in MySQL doesn't select it for use. You have to indicate it with the USE command. The USE command is also used when you have more than one database on a MySQL server and need to switch between them.

MySQL中创建数据库不会选择使用它。 您必须使用USE命令进行指示。 当您在一个MySQL服务器上有多个数据库并且需要在它们之间进行切换时,也会使用USE命令。

You must choose the correct database each time you start a MySQL session. 

每次启动MySQL会话时,都必须选择正确的数据库。

MySQL中的USE命令 ( The USE Command in MySQL )

The syntax for the USE command is:

USE命令的语法为:


mysql> ​

For example, this code switches to the database named "Dresses."

例如,此代码切换到名为“连衣裙”的数据库。


mysql> ​​

After you select a database, it remains the default until you end the session or choose another database with the USE command.

选择数据库后,它将保留默认值,直到您结束会话或使用USE命令选择另一个数据库为止。

识别当前数据库 ( Identifying the Current Database )

If you are unsure which database is currently in use, use the following code:

如果不确定当前正在使用哪个数据库,请使用以下代码:

This code returns the name of the database currently in use. If no database is currently in use, it returns NULL.

代码返回当前正在使用的数据库的名称。 如果当前未使用任何数据库,则返回NULL。

To view a list of available databases, use:

要查看可用数据库的列表,请使用:

关于MySQL ( About MySQL )

MySQL is an open-source relational database management system that is most often associated with web-based applications. It is the database software of choice for many of the web's largest sites including Twitter, Facebook, and YouTube. It is also the most popular database management system for small and medium-sized websites. Almost every commercial web host offers MySQL services.

MySQL是一种开源关系数据库管理系统,通常与基于Web的应用程序相关联。 它是许多Web最大站点(包括Twitter, Facebook和YouTube)的首选数据库软件。 它也是最受欢迎的中小型网站数据库管理系统。 几乎每个商业网络主机都提供MySQL服务。

If you are just using MySQL on a website, you won't need to be involved with the coding—the web host will handle all that—but if you are a developer new to MySQL, you'll need to learn SQL to write programs that access MySQL.

如果您只是在网站上使用MySQL,则无需参与编码-网络主机将处理所有这些工作-但是,如果您是MySQL的新开发人员,则需要学习SQL编写程序访问MySQL。

翻译自: https://www.thoughtco.com/use-sql-command-2693990

数据库use命令

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值