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

发布时间:2020-05-09 10:05:21 作者:三月
来源:亿速云 阅读:257

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

3.3 Creating and Using a Database

3.3 创建 使用数据库


如何通过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:

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

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. 创建mysq数据库,并创建管理用户
  2. MySQL 5.6 参考手册

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mysql参考手册 数据库

上一篇:java中int和integer的区别有哪些?

下一篇:MyBatis整体架构

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》