安裝MySQL樣本資料庫Sakila

來源:互聯網
上載者:User

標籤:database   mysql   dba   sql   資料庫   

    通常情況下對於一個全新的MySQL伺服器,沒有任何資料供我們測試和使用。對此,MySQL為我們提供了一些樣本資料庫,我們可以基於這些資料庫作基本的操作以及壓力測試等等。本文描述的是安裝sakila資料庫。該資料庫需要安裝在MySQL 5.0以上的版本。以下是其描述。

 

1、下載種子資料庫
下載位置:http://dev.mysql.com/doc/index-other.html

 

2、安裝種子資料庫sakila
[[email protected] ~]# unzip sakila-db.zip
Archive:  sakila-db.zip
   creating: sakila-db/
  inflating: sakila-db/sakila-schema.sql 
  inflating: sakila-db/sakila.mwb   
  inflating: sakila-db/sakila-data.sql

The sakila-schema.sql file contains all the CREATE statements required to create the structure of the Sakila database including tables, views, stored procedures, and triggers.

 
The sakila-data.sql file contains the INSERT statements required to populate the structure created by the sakila-schema.sql file, along with definitions for triggers that must be created after the initial data load.


The sakila.mwb file is a MySQL Workbench data model that you can open within MySQL Workbench to examine the database structure. For more information, see MySQL Workbench.

[[email protected] ~]# ls
anaconda-ks.cfg  Desktop  install.log  install.log.syslog  sakila-db  sakila-db.zip
[[email protected] ~]# cd sakila-db
[[email protected] sakila-db]# ls
sakila-data.sql  sakila.mwb  sakila-schema.sql

[[email protected] sakila-db]# mysql -uroot -p <sakila-schema.sql
Enter password:

[[email protected] sakila-db]# mysql -uroot -p <sakila-data.sql
Enter password:

 

3、驗證安裝結果
[[email protected] sakila-db]# mysql

[email protected][(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| scottdb            |
| tempdb             |
| test               |
+--------------------+
7 rows in set (0.01 sec)

[email protected][(none)]> use sakila

Database changed

[email protected][sakila]> show tables;
+----------------------------+
| Tables_in_sakila           |
+----------------------------+
| actor                      |
| actor_info                 |
| address                    |
| category                   |
| city                       |
| country                    |
| customer                   |
| customer_list              |
| film                       |
| film_actor                 |
| film_category              |
| film_list                  |
| film_text                  |
| inventory                  |
| language                   |
| nicer_but_slower_film_list |
| payment                    |
| rental                     |
| sales_by_film_category     |
| sales_by_store             |
| staff                      |
| staff_list                 |
| store                      |
+----------------------------+
23 rows in set (0.00 sec)

[email protected][sakila]> select count(*) from customer;
+----------+
| count(*) |
+----------+
|      599 |
+----------+
1 row in set (0.01 sec)

更多參考:  http://dev.mysql.com/doc/sakila/en/sakila-installation.html 

安裝MySQL樣本資料庫Sakila

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.