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


相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...