MySQL中安裝樣本數(shù)據(jù)庫Sakila過程分享
通常情況下對(duì)于一個(gè)全新的MySQL服務(wù)器,沒有任何數(shù)據(jù)供我們測(cè)試和使用。對(duì)此,MySQL為我們提供了一些樣本數(shù)據(jù)庫,我們可以基于這些數(shù)據(jù)庫作基本的操作以及壓力測(cè)試等等。本文描述的是安裝sakila數(shù)據(jù)庫。該數(shù)據(jù)庫需要安裝在MySQL 5.0以上的版本。以下是其描述。
1、下載種子數(shù)據(jù)庫
下載位置:http://dev.mysql.com/doc/index-other.html
2、安裝種子數(shù)據(jù)庫sakila
[root@localhost ~]# 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.
[root@localhost ~]# ls
anaconda-ks.cfg Desktop install.log install.log.syslog sakila-db sakila-db.zip
[root@localhost ~]# cd sakila-db
[root@localhost sakila-db]# ls
sakila-data.sql sakila.mwb sakila-schema.sql
[root@localhost sakila-db]# mysql -uroot -p <sakila-schema.sql
Enter password:
[root@localhost sakila-db]# mysql -uroot -p <sakila-data.sql
Enter password:
3、驗(yàn)證安裝結(jié)果
[root@localhost sakila-db]# mysql
root@localhost[(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sakila |
| scottdb |
| tempdb |
| test |
+--------------------+
7 rows in set (0.01 sec)
root@localhost[(none)]> use sakila
Database changed
root@localhost[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)
root@localhost[sakila]> select count(*) from customer;
+----------+
| count(*) |
+----------+
| 599 |
+----------+
1 row in set (0.01 sec)
相關(guān)文章
對(duì)比MySQL中int、char以及varchar的性能
在本篇文章中我們給大家分享了關(guān)于MySQL中int、char以及varchar的性能對(duì)比的相關(guān)內(nèi)容,有興趣的朋友們學(xué)習(xí)下。2018-10-10解決xmapp啟動(dòng)mysql出現(xiàn)Error: MySQL shutdown unexpec
這篇文章主要介紹了解決xmapp啟動(dòng)mysql出現(xiàn)Error: MySQL shutdown unexpectedly.問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-06-06MySQL數(shù)據(jù)庫如何給表設(shè)置約束詳解
約束主要完成對(duì)數(shù)據(jù)的檢驗(yàn),保證數(shù)據(jù)庫數(shù)據(jù)的完整性;如果有相互依賴數(shù)據(jù),保證該數(shù)據(jù)不被刪除,本篇文章教你如何給表設(shè)置約束2022-03-03mysql使用SQLyog導(dǎo)入csv數(shù)據(jù)不成功的解決方法
給mysql導(dǎo)入數(shù)據(jù),選中某個(gè)表選擇導(dǎo)入--導(dǎo)入使用本地csv數(shù)據(jù)即可,單有的時(shí)候不知道什么問題導(dǎo)入不成功2014-07-07Mysql 實(shí)現(xiàn)向上遞歸查找父節(jié)點(diǎn)并返回樹結(jié)構(gòu)的示例代碼
通過mysql 8.0以下版本實(shí)現(xiàn),一個(gè)人多角色id,一個(gè)角色對(duì)應(yīng)某個(gè)節(jié)點(diǎn)menu_id,根節(jié)點(diǎn)的父節(jié)點(diǎn)存儲(chǔ)為NULL, 向上遞歸查找父節(jié)點(diǎn)并返回樹結(jié)構(gòu),今天通過本文給大家介紹Mysql遞歸查找父節(jié)點(diǎn)并返回樹結(jié)構(gòu),感興趣的朋友一起看看吧2022-09-09