CDH集群安装配置(四)- mysql 的安装
-
安装mysql,并且创建相关的表(只需要在chd1上面安装而且需要root权限)1.1
-
查看Centos自带mysql是否已经安装
yum list installed | grep mysql
- 卸载自带mariadb
# rpm -qa | grep mariadb mariadb-libs-5.5.41-2.el7_0.x86_64 # rpm -e --nodeps mariadb-libs-5.5.41-2.el7_0.x86_64
-
如果系统的mysql已经安装,卸载
yum -y remove mysql-libs.x86_64
若有依赖关系,卸载依赖的包,知道显示结果complete
-
查看yum库上的mysql版本信息(CentOS系统需要正常连接网络)。
yum list | grep mysql 或 sudo yum -y list mysql*
-
yum安装mysql数据库
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
sudo yum update
sudo yum install mysql-server
sudo systemctl start mysqld
mysql-server、mysql、mysql-devel都安装好,当结果显示为“Complete!”即安装完毕。 注:安装mysql只是安装了数据库,只有安装mysql-server才相当于安装了客户端。
-
设置开机启动
systemctl enable mysqld
-
启动mysql
systemctl start mysqld
-
修改mysql密码
mysql -uroot mysql>use mysql; mysql>update user set password=password('root') where user='root' and host='localhost'; mysql>flush privileges; 验证是否修改成功 mysql -uroot -proot
修改mysql 访问权限
mysql> grant all privileges on *.* to 'root'@'mini1' identified by 'root';
mysql> flush privileges;创建cdh默认的数据库
GRANT ALL ON *.* TO 'root'@'%' identified by 'jesse@123'; create database scm DEFAULT CHARSET utf8 COLLATE utf8_general_ci; create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci; create database rman DEFAULT CHARSET utf8 COLLATE utf8_general_ci; create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci; create database metastore DEFAULT CHARSET utf8 COLLATE utf8_general_ci; create database sentry DEFAULT CHARSET utf8 COLLATE utf8_general_ci; create database nav DEFAULT CHARSET utf8 COLLATE utf8_general_ci; create database navms DEFAULT CHARSET utf8 COLLATE utf8_general_ci; create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci; GRANT ALL ON *.* TO 'scm'@'%' identified by 'jesse@123'; GRANT ALL ON *.* TO 'amon'@'%' identified by 'jesse@123'; GRANT ALL ON *.* TO 'rman'@'%' identified by 'jesse@123'; GRANT ALL ON *.* TO 'hue'@'%' identified by 'jesse@123'; GRANT ALL ON *.* TO 'hive'@'%' identified by 'jesse@123'; GRANT ALL ON *.* TO 'sentry'@'%' identified by 'jesse@123'; GRANT ALL ON *.* TO 'nav'@'%' identified by 'jesse@123'; GRANT ALL ON *.* TO 'navms'@'%' identified by 'jesse@123'; GRANT ALL ON *.* TO 'oozie'@'%' identified by 'jesse@123'; flush privileges;