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

 更新时间:2014年10月31日 10:50:26   作者:Leshami  
这篇文章主要介绍了MySQL中安装样本数据库Sakila过程分享,Sakila数据库主要用来做一些基本的操作以及压力测试等,需要的朋友可以参考下

通常情况下对于一个全新的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模糊查询优化方法及测试详细讲解

    这篇文章主要介绍了Mysql模糊查询优化方法及测试,在MySQL中支持模糊匹配的方法有很多,且各有各的优点,感兴趣想要详细了解可以参考下文
    2023-05-05
  • Mysql数据库的QPS和TPS的意义和计算方法

    Mysql数据库的QPS和TPS的意义和计算方法

    今天小编就为大家分享一篇关于Mysql数据库的QPS和TPS的意义和计算方法,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
    2019-03-03
  • MySQL ClickHouse常用表引擎超详细讲解

    MySQL ClickHouse常用表引擎超详细讲解

    这篇文章主要介绍了MySQL ClickHouse常用表引擎,ClickHouse表引擎中,CollapsingMergeTree和VersionedCollapsingMergeTree都能通过标记位按规则折叠数据,从而达到更新和删除的效果
    2022-11-11
  • Mysql row number()排序函数的用法和注意

    Mysql row number()排序函数的用法和注意

    这篇文章主要介绍了Mysql row number()排序函数的用法和注意 的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下
    2016-07-07
  • MySQL字符串函数详解(推荐)

    MySQL字符串函数详解(推荐)

    下面小编就为大家带来一篇MySQL字符串函数详解(推荐)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2016-06-06
  • 你真的会用Mysql的explain吗

    你真的会用Mysql的explain吗

    explain显示了mysql如何使用索引来处理select语句以及连接表,可以帮助选择更好的索引和写出更优化的查询语句,下面这篇文章主要给大家介绍了关于Mysql中explain用法的相关资料,需要的朋友可以参考下
    2022-03-03
  • MySQL 开窗函数

    MySQL 开窗函数

    这篇文章主要介绍了MySQL 开窗函数
    2022-02-02
  • 详解一条update语句是怎样执行原理解析

    详解一条update语句是怎样执行原理解析

    这篇文章主要为大家介绍了详解一条update语句是怎样执行原理解析,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2022-12-12
  • kali虚拟机mysql修改绑定ip的问题

    kali虚拟机mysql修改绑定ip的问题

    这篇文章主要介绍了kali虚拟机mysql修改绑定ip,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2022-06-06
  • C++连接使用MySQL的方法

    C++连接使用MySQL的方法

    这篇文章主要为大家详细介绍了C++连接使用MySQL的方法,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-07-07

最新评论