MySQL中安装样本数据库Sakila过程分享

所属分类: 数据库 / Mysql 阅读数: 1779
收藏 0 赞 0 分享

通常情况下对于一个全新的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)

更多精彩内容其他人还在看

MySQL中的基本查询语句学习笔记

这篇文章主要介绍了MySQL中的基本查询语句学习笔记,包括使用limit限制查询结果条数和合并查询结果的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

详解MySQL中的分组查询与连接查询语句

这篇文章主要介绍了MySQL中的分组查询与连接查询语句,同时还介绍了一些统计函数的用法,需要的朋友可以参考下
收藏 0 赞 0 分享

linux下安装升级mysql到新版本(5.1-5.7)

这篇文章主要介绍了linux下安装升级mysql到新版本(5.1-5.7),需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL备份时排除指定数据库的方法

这篇文章主要介绍了MySQL备份时排除指定数据库的方法的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

Mysql数据库之索引优化

MySQL凭借着出色的性能、低廉的成本、丰富的资源,已经成为绝大多数互联网公司的首选关系型数据库。本文给大家介绍mysql数据库之索引优化,感兴趣的朋友一起学习吧
收藏 0 赞 0 分享

Mysql性能优化方案分享

这篇文章主要为大家分享了Mysql性能优化方案,帮助大家进行Mysql性能优化,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

MySQL中一些常用的数据表操作语句笔记

这篇文章主要介绍了MySQL中一些常用的数据表操作语句笔记,其中重点讲解了删除关联表的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

mysql版本5.5.x升级到5.6.x步骤分享

在我做的一个项目中,最近我对生产服务器上的一系列系统软件进行了升级,包括git、nginx、MySQL和PHP。这篇文章讲的是升级MySQL的过程,其他软件的升级将在其他文章中介绍。
收藏 0 赞 0 分享

Mysql IO 内存方面的优化

这篇文章主要介绍了Mysql IO 内存方面的优化 的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

Mysql忘记root密码怎么办

MySQL有时候忘记了root密码是一件伤感的事,下面通过本文给大家介绍Mysql忘记root密码怎么办的相关知识,需要的朋友参考下
收藏 0 赞 0 分享
查看更多