准备MySQL数据
登录MySQL数据库
mysql -u root -p123456;
创建student数据库
create database student;
切换数据库并导入数据
# mysql shell中执行
use student;
#/root/student.sql为student.sql在虚拟机上的绝对路径
#studnet.sql和score.sql是提前下载在虚拟机上的
source /root/student.sql;
source /root/score.sql;
注:该文件格式为.sql!若为txt文件,在导入数据前一定要先建好表,导入数据时还要定义列分割符否则会出现null的情况。
另外一种导入数据的方式
# linux shell中执行
mysql -u root -p123456 student</root/student.sql
mysql -u root -p123456 student</root/score.sql
导出MySQL数据库
mysqldump -u root -p123456 数据库名>任意一个文件名.sql
import
从传统的关系型数据库导入HDFS、HIVE、HBASE......
MySQLToHDFS
MySQL导入hdfs
在虚拟机本地上编写脚本,保存为MySQLToHDFS.conf
vim MySQLToHDFS.conf
impor