• MySQL安装示例数据库


    MySQL安装示例数据库

    本文档演示如何下载及安装MySQL示例数据库sakila及employees数据库

    1. 安装sakila数据库

    1.1 下载sakila数据库

    wget http://downloads.mysql.com/docs/sakila-db.tar.gz

    1.2 解压

    # tar zxvf sakila-db.tar.gz
    # ll -h sakila-db/
    total 3.4M
    -rw-r--r--. 1 500 500 3.3M Jul 21  2016 sakila-data.sql         --插入语句
    -rw-r--r--. 1 500 500  49K Jul 21  2016 sakila.mwb              --数据模型
    -rw-r--r--. 1 500 500  23K Jul 21  2016 sakila-schema.sql       --创建语句

    1.3 安装数据库

    mysql> source ./sakila-db/sakila-schema.sql
    mysql> source ./sakila-db/sakila-data.sql

    1.4 检查安装的数据库

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | info               |
    | move_db            |
    | mysql              |
    | mysql3306_data     |
    | performance_schema |
    | sakila             |
    | sbtest             |
    | sys                |
    | test               |
    | undolog            |
    +--------------------+
    11 rows in set (0.00 sec)
    
    mysql> use sakila
    Database changed
    mysql> 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)

    1.5 查看数据模型

    2. 安装employees数据库

    2.1 下载

    # wget https://launchpad.net/test-db/employees-db-1/1.0.5/+download/employees_db-full-1.0.5.tar.bz2
    
    # md5sum employees_db-full-1.0.5.tar.bz2 
    08d97b7b6ab87887c434eaa32ae50158  employees_db-full-1.0.5.tar.bz2

    2.2 解压

    # tar -jxvf employees_db-full-1.0.5.tar.bz2 
    employees_db/load_departments.dump
    employees_db/load_dept_emp.dump
    employees_db/load_dept_manager.dump
    employees_db/load_employees.dump
    employees_db/load_salaries.dump
    employees_db/load_titles.dump
    employees_db/employees.sql
    employees_db/employees_partitioned.sql
    employees_db/objects.sql
    employees_db/test_employees_md5.sql
    employees_db/test_employees_sha.sql
    employees_db/Changelog
    employees_db/README

    2.3 安装数据库

    mysql> source /data/mysql/mysql3306/employees_db/employees.sql

    2.4 检查安装的数据库

    root@localhost [employees] 16:39:42>show tables;
    +---------------------+
    | Tables_in_employees |
    +---------------------+
    | departments         |
    | dept_emp            |
    | dept_manager        |
    | employees           |
    | salaries            |
    | titles              |
    +---------------------+
    6 rows in set (0.00 sec)
  • 相关阅读:
    个人日志-6.27
    <软件工程>课程总结
    团队项目--地铁信息查询-UML图初步设计
    7-4 日报
    7-5小组日报 最终版的发布
    7-1 7-3
    软工日报6-30
    软工日报 6-29
    6-28小组会议记录
    6-27小组讨论内容
  • 原文地址:https://www.cnblogs.com/wanbin/p/9525172.html
Copyright © 2020-2023  润新知