前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >安装MySQL样本数据库Sakila

安装MySQL样本数据库Sakila

作者头像
Leshami
发布2018-08-13 14:43:05
8720
发布2018-08-13 14:43:05
举报

    通常情况下对于一个全新的MySQL服务器,没有任何数据供我们测试和使用。对此,MySQL为我们提供了一些样本数据库,我们可以基于这些数据库作基本的操作以及压力测试等等。本文描述的是安装sakila数据库。该数据库需要安装在MySQL 5.0以上的版本。以下是其描述。

1、下载种子数据库 下载位置:http://dev.mysql.com/doc/index-other.html

2、安装种子数据库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、验证安装结果 [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)

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2014年10月15日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 MySQL
腾讯云数据库 MySQL(TencentDB for MySQL)为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。其具备6大企业级特性,包括企业级定制内核、企业级高可用、企业级高可靠、企业级安全、企业级扩展以及企业级智能运维。通过使用腾讯云数据库 MySQL,可实现分钟级别的数据库部署、弹性扩展以及全自动化的运维管理,不仅经济实惠,而且稳定可靠,易于运维。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档