【Linux】统信UOS服务器安装MySQL8.0(RPM)
目录
一、下载安装包
二、安装MySQL
2.1hive适配
2.2ranger适配
3.2DolphinScheduler适配
一、下载安装包
官网下载安装包:MySQL :: MySQL Downloads
选择社区版本下载
点击MySQL Community Server
选择对应系统的MySQL版本号
统信1060a 操作系统对应 redhat8 ,我们下载对应MySQL RPM包
选择直接下载
二、安装MySQL
## 解压
tar -xvf mysql-8.0.40-1.el8.x86_64.rpm-bundle.tar
## 安装
yum install -y net-tools perl libaio
rpm -ivh mysql-community-common-8.0.40-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.40-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.40-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.40-1.el8.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.40-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-8.0.40-1.el8.x86_64.rpm
启动MySQL
systemctl start mysqld 这个是启动mysql
systemctl status mysqld 查看mysql的状态
# 查看默认密码
grep password /var/log/mysqld.log
查看密码
grep password /var/log/mysqld.log
-- 进入mysql
mysql -uroot -p 敲回车
粘贴密码即可
修改默认密码
alter user root@localhost identified by 'G1u2n3h4e5!';
4、更改密码策略等级
set global validate_password.policy=LOW; # 修改密码策略等级为LOW
set global validate_password.length=4; # 密码的最小长度
set global validate_password.mixed_case_count=0; # 设置密码中至少要包含0个大写字母和小写字母
set global validate_password.number_count=0; # 设置密码中至少要包含0个数字
set global validate_password.special_char_count=0; # 设置密码中至少要包含0个特殊字符
5、 修改更简单的密码
alter user root@localhost identified by 'Winner@123456';
修改密码
创建用户和数据库
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
-- datasophon元数据库
CREATE DATABASE IF NOT EXISTS datasophon DEFAULT CHARACTER SET utf8;
create user datasophon@'%' identified by 'datasophon';
grant all privileges on *.* to datasophon@'%' with grant option;
FLUSH PRIVILEGES;
-- hive元数据库
CREATE DATABASE IF NOT EXISTS hive DEFAULT CHARACTER SET utf8;
create user hive@'%' identified by 'hive';
grant all privileges on *.* to hive@'%' with grant option;
FLUSH PRIVILEGES;
-- ranger元数据库
CREATE DATABASE IF NOT EXISTS ranger DEFAULT CHARACTER SET utf8;
create user ranger@'%' identified by 'Winner@123456';
grant all privileges on *.* to ranger@'%' with grant option;
FLUSH PRIVILEGES;
-- dolphinscheduler元数据库
CREATE DATABASE IF NOT EXISTS dolphinscheduler DEFAULT CHARACTER SET utf8;
create user dolphinscheduler@'%' identified by 'dolphinscheduler';
grant all privileges on *.* to dolphinscheduler@'%' with grant option;
FLUSH PRIVILEGES;
use dolphinscheduler;
source /opt/datasophon/DDP/packages/dolphinscheduler_mysql.sql;
2.1hive适配
-- 数据库链接地址
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://ddp01:3306/hive?useUnicode=true&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&useSSL=false</value>
</property>
-- 初始化数据库
cd bin
./schematool -dbType mysql -initSchema
适配hive需要增加jar包,修改jdbc 连接URL。
2.2ranger适配
初始化SQL文件中添加如下参数:
set global log_bin_trust_function_creators=TRUE;
/home/datasophon/ranger-2.1.0/db/mysql/optimized/current/ranger_core_db_mysql.sql
可能报错如下,加上面的参数可避免
2025-01-08 15:38:17,746 [JISQL] /usr/java/jdk1.8.0_162/bin/java -cp /opt/datasophon/ranger-2.1.0/mysql-connector-java-8.0.28.jar:/home/datasophon/ranger-2.1.0/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://127.0.0.1/ranger -u 'ranger' -p '********' -noheader -trim -c \; -input /home/datasophon/ranger-2.1.0/db/mysql/optimized/current/ranger_core_db_mysql.sql
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
Error executing: CREATE FUNCTION `getXportalUIdByLoginId`(input_val VARCHAR(100)) RETURNS int(11) BEGIN DECLARE myid INT; SELECT x_portal_user.id into myid FROM x_portal_user WHERE x_portal_user.login_id = input_val; RETURN myid; END
java.sql.SQLException: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
SQLException : SQL state: HY000 java.sql.SQLException: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) ErrorCode: 1418
2025-01-08 15:38:39,290 [E] ranger_core_db_mysql.sql file import failed!
3.2DolphinScheduler适配
DolphinScheduler数据库地址:
jdbc:mysql://ddp01:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
hive的安装和配置:
Hive3.1.2与MySQL8.0集成配置教程-CSDN博客
ranger 2.3.0 从源码编译到搭配 MySQL 8.0 的踩坑:
ranger 2.3.0 从源码编译到搭配 MySQL 8.0 的踩坑-腾讯云开发者社区-腾讯云
Hadoop_HA搭建:
Hadoop_HA搭建_hadoop ha-CSDN博客
ubuntu下Hive3.1.3与MySQL8的配置与安装:
ubuntu下Hive3.1.3与MySQL8的配置与安装_hive3 mysql8-CSDN博客