您好,登錄后才能下訂單哦!
本文主要給大家簡單講講如何通過MySQ3.3參考手冊創建并使用數據庫,相關專業術語大家可以上網查查或者找一些相關書籍補充一下,這里就不涉獵了,我們就直奔主題吧,希望如何通過MySQ3.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參考手冊創建并使用數據庫就先給大家講到這里,對于其它相關問題大家想要了解的可以持續關注我們的行業資訊。我們的板塊內容每天都會捕捉一些行業新聞及專業知識分享給大家的。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。