1.上传并解压MySQL
2.改名
3.配置MySQL环境变量,并source
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin
4.在MySQL下新建data文件夹
5.建一个MySQL组
6.在MySQL组下建user组
7.更改MySQL目录所属的组和用户![](https://i-blog.csdnimg.cn/blog_migrate/ebadf5d7ee3cb33b28d8e050a4c05833.png)
8.初始化MySQL![](https://i-blog.csdnimg.cn/blog_migrate/cba70093602ccd62ce0cd6c1641cb387.png)
注:保存初始化密码(每个人的初始化密码不一样),初次登陆要用(我的密码:ddtV92GOtH,7)
mysqld --initialize --user mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
9.配置启动文件
vim mysql
修改完后重启
10.启动MySQL服务(service mysql start),用service mysql status查询状态
11.登录MySQL
12.修改密码
set password=password('123456');
13.刷新权限
flush privileges;
14.授权给root账户并通过密码123456进行访问
grant all on *.* to 'root'@'%' identified by '123456';
15.解压hive
16.改名
17.进入hive的conf目录下cp生成hive-env.sh文件
18. 编辑配置文件
19.cp生成新文件并用echo覆盖成空文件
20.编辑配置文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/myhive?useSSL=false</value>
<description/>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description/>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description/>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
<description/>
</property>
</configuration>
21.进入bin下修改文件
export HIVE_HOME=/usr/local/hive
export HADOOP_HOME=/usr/local/hadoop
export JAVA_HOME=/usr/local/jdk
22.进入~/.bashrc,配置文件并source
export HIVE_HOME=/usr/local/hive
export PATH=$PATH:$HIVE_HOME/bin
23.启动hive,需要先启动hadoop,并在bin下启动hive
24.cp文件
25.启动MySQL
26.进入MySQL创建数据库
27.hive创建数据报错
create table emp(
> empno int,
> ename string)
> row format delimited fields terminated by '\t';
补: 解决方法:初始化
1.修改配置文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/myhive?useSSL=false</value> <description/> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description/> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>root</value> <description/> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>123456</value> <description/> </property> </configuration>
2.初始化
schematool -dbType mysql -initSchema
3.初始化成功