安装MySQL
# 检测主机是否安装了自带的mysql
rpm -qa | grep 'mysql'
# 卸载自带的mysql
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
# 使用yum安装mysql
yum install -y mysql-server
# 安装完毕启动mysql服务
service mysqld status
service mysqld start
# 重新设置root密码
/usr/bin/mysqladmin -u root password '123456'
# 登录mysql
mysql -uroot -p123456
# 设置MYSQL允许远程用户登录
show databases;
use mysql;
show tables;
select host,user from user;
执行设置远程登录信息命令
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
# 删除用户信息,只保留 host='%'
delete from user where host='localhost';
delete from user where host='127.0.0.1';
delete from user where host='主机名';
# 刷新信息
flush privileges;
# 退出mysql并重启mysql服务
service mysqld restart;
到此,mysql安装配置完毕
配置Hive的元数据库为MySql
# 复制 conf/hive-default.xml.template 并重名命 hive-site.xml
cd /opt/apache_hadoop/apache-hive-1.2