如何通过MySQ3.3参考手册创建并使用数据库
admin
2023-05-23 03:43:08
0

本文主要给大家简单讲讲如何通过MySQ3.3参考手册创建并使用数据库,相关专业术语大家可以上网查查或者找一些相关书籍补充一下,这里就不涉猎了,我们就直奔主题吧,希望如何通过MySQ3.3参考手册创建并使用数据库这篇文章可以给大家带来一些实际帮助。

3.3 Creating and Using a Database

3.3 创建 使用数据库

  • 3.3.1 Creating and Selecting a Database

  • 3.3.2 Creating a Table

  • 3.3.3 Loading Data into a Table

  • 3.3.4 Retrieving Information from a Table


  • 3.3.1 创建和查看数据库

  • 3.3.2 创建表

  • 3.3.3 将数据加载到表

  • 3.3.4 检索表中的信息

如何通过MySQ3.3参考手册创建并使用数据库

Once you know how to enter SQL statements, you are ready to access a database.

上一节你知道了怎么输入SQL 语句。你已经准备好访问数据库了。

Suppose that you have several pets in your home (your menagerie) and you would like to keep track of various types of information about them. You can do so by creating tables to hold your data and loading them with the desired information. Then you can answer different sorts of questions about your animals by retrieving data from the tables. This section shows you how to perform the following operations:

假设你家有几只宠物,你想追踪他们的一些信息,你可以通过创建表来保存数据,按照所需加载数据。你就可以从表中检索数据来回答关于动物的不同问题。这一节 向你展示了 如何进行以下操作。

  • Create a database

  • Create a table

  • Load data into the table

  • Retrieve data from the table in various ways

  • Use multiple tables

  • 创建一个数据库

  • 创建一个数据库

  • 向表中加载数据

  • 用不同的方式在表中检索数据

  • 使用多个表

The menagerie database is simple (deliberately), but it is not difficult to think of real-world situations in which a similar type of database might be used. For example, a database like this could be used by a farmer to keep track of livestock, or by a veterinarian to keep track of patient records. A menagerie distribution containing some of the queries and sample data used in the following sections can be obtained from the MySQL Web site. It is available in both compressed tar file and Zip formats at http://dev.mysql.com/doc/.

menagerie 数据库是简单的(故意的),但是不难想象真实情况下相似情况的数据库。例如一个类似的数据库可以被农民用来记录用来跟踪牲畜,或由兽医追踪病宠的记录。你可以从MySQL网站获取menagerie数据库,它包含一些语句和简单的数据。在http://dev.mysql.com/doc/网站上提供 tar(linux) 和 Zip(windows)两种打包的版本。

Use the SHOW statement to find out what databases currently exist on the server:

使用SHOW语句来查×××器上当前存在的数据库:

mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
| mysql    |
| test     |
| tmp      |
+----------+

The mysql database describes user access privileges. The test database often is available as a workspace for users to try things out.

mysql 数据库 描述了用户的访问权限。test 数据库 通常是给用户提供测试空间。

The list of databases displayed by the statement may be different on your machine; SHOW DATABASES does not show databases that you have no privileges for if you do not have the SHOW DATABASES privilege. See Section 13.7.5.15, “SHOW DATABASES Syntax”.

语句显示的数据库列表可能在您的机器上不同; SHOW DATABASES不显示那些 你没有SHOW DATABASES 权限的数据库。请参见第13.7.5.15节“SHOW DATABASES语法”。

If the test database exists, try to access it:

如果test数据库存在,请尝试访问它:

mysql> USE test
Database changed

USE, like QUIT, does not require a semicolon. (You can terminate such statements with a semicolon if you like; it does no harm.) The USE statement is special in another way, too: it must be given on a single line.

USE, 类似 QUIT,不需要分好(如果你喜欢,你可以使用分号终止这样的语句;这样做是OK的)另一方面 USE 是特殊的:use语句只能写在一行之中。

You can use the test database (if you have access to it) for the examples that follow, but anything you create in that database can be removed by anyone else with access to it. For this reason, you should probably ask your MySQL administrator for permission to use a database of your own. Suppose that you want to call yours menagerie. The administrator needs to execute a statement like this:

您可以使用test数据库(如果您有权访问该数据库)以获得以下示例,但是任何可以访问该数据库的人都可以删除该数据库中创建的任何内容。因此,您可以要求您的MySQL管理员仅仅允许你访问该数据库。假设你想访问你的 menagerie数据库。管理员需要执行如下语句:

mysql> GRANT ALL ON menagerie.* TO 'your_mysql_name'@'your_client_host';

where your_mysql_name is the MySQL user name assigned to you and your_client_host is the host from which you connect to the server.

your_mysql_name 是分配给您的MySQL用户名,your_client_host是你的主机。

如何通过MySQ3.3参考手册创建并使用数据库就先给大家讲到这里,对于其它相关问题大家想要了解的可以持续关注我们的行业资讯。我们的板块内容每天都会捕捉一些行业新闻及专业知识分享给大家的。


相关内容

热门资讯

电脑pin什么意思 电脑pin... 电脑pin是使用比较多的一种身份识别技术,即随机生成但是可验证的一组身份验证识别序列。它在windo...
小鸭洗衣迷你脱水桷电机响不转怎... 1、洗衣机在洗衣服时,如果电机有嗡嗡声但不转,就有可能是启动电容器的问题。如果电机没有一点声音,就可...
油烟机电机不转的原因 油烟机是常见的厨房电器之一,一般用于排除厨房的烟雾和异味,对保持厨房环境干净卫生非常重要。但是偶尔出...
油烟机一直滴滴响打不开怎么回事 油烟机一直滴滴响打不开的原因有几种:1、油烟机的烟雾感应器出现故障,误识油烟为起火的烟雾导致滴滴响打...
打印机共享怎么连接第二台电脑 如今,打印机已经成为我们工作和生活中不可或缺的设备之一。而打印机共享则是在一个办公环境中非常常见的操...
男子忌日宴疑因幻听行凶致2死1... 8月4日,山东聊城“疑因幻听行凶致邻居2死1伤”案伤者刘现为向@百姓关注 记者还原事发经过。
韩国检察官“只手遮天”的时代结... 韩国政府今天召开由总统李在明主持的国务会议,通过《刑事诉讼法》修正案,全面废除检察官直接侦查及补充侦...
天津发文推进带薪休假落地:摒弃... 澎湃新闻记者 钟煜豪“摒弃‘爱岗敬业不能休’的错误认识,清理‘攀比内卷不愿休’的职场环境,消除‘业绩...
摩洛哥非法移民讲述:为何突然越... 亚辛(Yassine)今年24岁,来自摩洛哥北部城市得土安。7月30日,天气晴朗,最高温度30摄氏度...
原创 成... 深夜,手机屏幕的光映着很多人的脸。只要轻轻一点,就能看到大量成人内容,免费、方便、不用露脸——看起来...