學習30天mysql教程之导入mysql的示例数据库(part2)
2019-04-03 11:02
295 查看
导入mysql的示例数据库
第一步: 从MySQL示例数据库文章中下载示例数据库(
yiibaidb),有关示例数据库的结构,请参考: http://www.yiibai.com/mysql/sample-database.html
第二步: 将下载的文件解压缩到临时文件夹中。为了简单起见,我们将把它解压缩到D:\worksp,如下所示 -
第三步: 连接到MySQL服务器并创建数据库
[code]D:\software\mysql-5.7.18-winx64\bin>mysql -hlocalhost -uroot -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 23 Server version: 5.7.9 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
Shell
创建数据库 -
[code]mysql> CREATE DATABASE IF NOT EXISTS yiibaidb DEFAULT CHARSET utf8 COLLATE utf8_general_ci; mysql> use yiibaidb;
Shell
导入数据 -
[code]mysql> use yiibaidb; mysql> source D:/worksp/yiibaidb.sql;
Shell
第四步: 测试导入结果
[code]mysql> select city,phone,country from `offices`; +---------------+------------------+-----------+ | city | phone | country | +---------------+------------------+-----------+ | San Francisco | +1 650 219 4782 | USA | | Boston | +1 215 837 0825 | USA | | NYC | +1 212 555 3000 | USA | | Paris | +33 14 723 4404 | France | | Beijing | +86 33 224 5000 | China | | Sydney | +61 2 9264 2451 | Australia | | London | +44 20 7877 2041 | UK | +---------------+------------------+-----------+ 7 rows in set (0.00 sec)
Shell
在本教程中,我们演示了如何使用MySQL命令行将MySQL示例数据库导入到MySQL数据库服务器中。
原文出自【易百教程】,商业转载请联系作者获得授权,非商业转载请保留原文链接:https://www.yiibai.com/mysql/how-to-load-sample-database-into-mysql-database-server.html
相关文章推荐
- TPC-H数据导入MySQL教程
- Windows下MySQL日志基本的查看以及导入导出用法教程
- MySQL中数据导入恢复的简单教程
- Navicat for mysql导入.sql文件教程
- 教程 | 使用Sqoop从MySQL导入数据到Hive和HBase
- SQLServer2005数据导入Mysql到详细教程(测试)
- 【mysql学习系列】Mysql数据库导入官方示例数据库
- SQL Server 数据导入Mysql详细教程
- 导入 Mysql 示例数据库 employees
- 导入 Mysql 示例数据库 employees
- SQLServer2005数据导入Mysql到详细教程
- SQL Server 数据导入Mysql详细教程
- 将sqlite3中数据导入到mysql中的实战教程
- windows :TPC-H测试的数据库模式生成及其数据导入MySQL的教程记录
- SQL Server 数据导入Mysql详细教程
- SQL Server 数据导入Mysql详细教程
- LNMP 下使用命令导出导入 MySQL 数据库教程
- MySQL入门教程系列一----表的导出与导入
- 数据库----(linux下安装mysql-5.7.19 创建数据库并且导入数据库文件 教程)
- Linux中将txt导入到mysql的方法教程