安装教程
https://blog.csdn.net/qq_37598011/article/details/93489404
cdh集群链接mysql 命令
grant all on scm.* TO scm@localhost IDENTIFIED BY ‘scm_password’;
create database amon DEFAULT CHARACTER SET utf8;
grant all on amon.* TO ‘amon’@‘%’ IDENTIFIED BY ‘amon_password’;
grant all on amon.* TO amon@localhost IDENTIFIED BY ‘amon_password’;
create database smon DEFAULT CHARACTER SET utf8;
grant all on smon.* TO ‘smon’@‘%’ IDENTIFIED BY ‘smon_password’;
create database rman DEFAULT CHARACTER SET utf8;
grant all on rman.* TO ‘rman’@‘%’ IDENTIFIED BY ‘rman_password’;
create database hmon DEFAULT CHARACTER SET utf8;
grant all on hmon.* TO ‘hmon’@‘%’ IDENTIFIED BY ‘hmon_password’;
create database hive DEFAULT CHARACTER SET utf8;
grant all on hive.* TO ‘hive’@‘%’ IDENTIFIED BY ‘hive_password’;
grant all on smon.* TO smon@localhost IDENTIFIED BY ‘smon_password’;
grant all on rman.* TO rman@localhost IDENTIFIED BY ‘rman_password’;
grant all on hmon.* TO hmon@localhost IDENTIFIED BY ‘hmon_password’;
grant all on hive.* TO hive@localhost IDENTIFIED BY ‘hive_password’;
开启binlog日志方式
1、查看binlog状态语句
- show variables like ‘%log_bin%’;
2、查看binlog日志格式
- show variables like ‘%binlog_format%’;
3、创建目录和设置权限组
mkdir /usr/local/mysql/log-bin
chown -R mysql:mysql /usr/local/mysql
chmod -R 755 /usr/local/mysql
4、修改MySQL配置(my.cnf)
vi /etc/my.cnf
# server-id表示单个结点的id,这里由于只有一个结点,所以可以把id随机指定为一个数,这里将id设置成1。若集群中有多个结点,则id不能相同
server-id=1
# log-bin日志文件的名字为mysql-bin,以及其存储路径
log-bin=/usr/local/mysql/log-bin/mysql-bin
#设置格式为ROW
binlog_format=ROW
5、停止mysql
- service mysql stop
6、重启mysql
- service mysql start
7、跳过输入密码直接进入
vim /etc/my.cnf
skip-grant-tables
8、修改密码
update user set authentication_string=password("chrd5hdhxt!") where user="root";
flush privileges;