如何通过MySQ3.3参考手册创建并使用数据库
本文主要给大家简单讲讲如何通过MySQ3.3参考手册创建并使用数据库,相关专业术语大家可以上网查查或者找一些相关书籍补充一下,这里就不涉猎了,我们就直奔主题吧,希望如何通过MySQ3.3参考手册创建并使用数据库这篇文章可以给大家带来一些实际帮助。
创新互联公司专注于企业成都全网营销推广、网站重做改版、东湖网站定制设计、自适应品牌网站建设、H5页面制作、商城网站建设、集团公司官网建设、成都外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为东湖等各大城市提供网站开发制作服务。
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 检索表中的信息
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参考手册创建并使用数据库就先给大家讲到这里,对于其它相关问题大家想要了解的可以持续关注我们的行业资讯。我们的板块内容每天都会捕捉一些行业新闻及专业知识分享给大家的。
网页名称:如何通过MySQ3.3参考手册创建并使用数据库
标题来源:http://ybzwz.com/article/gogjjp.html