[ main] DbCommandExecutor ERROR Error when connecting to datab

出现报错:
Tue Dec 05 22:30:26 CST 2023 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[ main] DbCommandExecutor ERROR Error when connecting to database.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,132 milliseconds ago. The last packet sent successfully to the server was 1,090 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_221]

[root@node1 lib]# /opt/cloudera/cm/schema/scm_prepare_database.sh -h localhost mysql scm root 123456
JAVA_HOME=/usr/java/jdk
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing:  /usr/java/jdk/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/java/postgresql-connector-java.jar:/opt/cloudera/cm/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
Tue Dec 05 22:30:26 CST 2023 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[                          main] DbCommandExecutor              ERROR Error when connecting to database.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,132 milliseconds ago.  The last packet sent successfully to the server was 1,090 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_221]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_221]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_221]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_221]
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:203)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4901)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2191)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2222)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2017)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:779)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)[mysql-connector-java.jar:5.1.44]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_221]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_221]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_221]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_221]
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)[mysql-connector-java.jar:5.1.44]
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)[mysql-connector-java.jar:5.1.44]
	at java.sql.DriverManager.getConnection(DriverManager.java:664)[:1.8.0_221]
	at java.sql.DriverManager.getConnection(DriverManager.java:247)[:1.8.0_221]
	at com.cloudera.enterprise.dbutil.DbCommandExecutor.testDbConnection(DbCommandExecutor.java:263)[db-common-6.2.1.10e4e355f9397ec3d22db9e4464f47f8.jar:]
	at com.cloudera.enterprise.dbutil.DbCommandExecutor.main(DbCommandExecutor.java:139)[db-common-6.2.1.10e4e355f9397ec3d22db9e4464f47f8.jar:]
[                          main] DbCommandExecutor              ERROR Exiting with exit code 4
--> Error 4, giving up (use --force if you wish to ignore the error)
[root@node1 lib]# 

vim /etc/my.cnf

vim /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /var/lib/mysql
port = 3306
socket=/var/lib/mysql/mysql.sock
character-set-server=utf8

transaction-isolation = READ-COMMITTED
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
symbolic-links = 0

server_id=1
max-binlog-size = 500M
log_bin=/var/lib/mysql/mysql_binary_log
#binlog_format = mixed
binlog_format = Row
expire-logs-days = 14

max_connections = 550
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M

# InnoDB settings
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit  = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 4G
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M

[client]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock

[mysql]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

sql_mode=STRICT_ALL_TABLES
skip-ssl

解决办法:解决办法
mysql:mysql下载以及配置

[ main] DbCommandExecutor ERROR Error when connecting to datab_第1张图片

补充:
SSL协议

SSL协议提供服务主要:
1)认证用户服务器,确保数据发送到正确的服务器;    .
2)加密数据,防止数据传输途中被窃取使用;
3)维护数据完整性,验证数据在传输过程中是否丢失;
当前支持SSL协议两层:
SSL记录协议(SSL Record Protocol):建立靠传输协议(TCP)高层协议提供数据封装、压缩、加密等基本功能支持
SSL握手协议(SSL Handshake Protocol):建立SSL记录协议用于实际数据传输始前通讯双进行身份认证、协商加密
算法、 交换加密密钥等。
不建议在没有服务器身份验证的情况下建立SSL连接。根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果不设置显式选项,则必须建立默认的SSL连接。需要通过设置useSSL=false来显式禁用SSL,或者设置useSSL=true并为服务器证书验证提供信任存储。

我看大多数人都是这里添加的,但是我并未使用这里[ main] DbCommandExecutor ERROR Error when connecting to datab_第2张图片
但是我目前在虚拟机中,所以要修改mysql的配置文件
vim /etc/my.cnf
https://blog.csdn.net/qq_39572257/article/details/116227265#:~:text=%E4%BA%8C%E3%80%81MySQL%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%201%20%E5%BC%BA%E5%88%B6ssl%E9%AA%8C%E8%AF%81%20%E5%9C%A8%20%5Bmysqld%5D%E4%B8%8B%E6%B7%BB%E5%8A%A0%E5%A6%82%E4%B8%8B%E4%BB%A3%E7%A0%81%EF%BC%9A%20require_secure_transport%20%3D%20ON,%3D%20%2Fdata%2Fmysql-ssl%2Fca.pem%20ssl-cert%20%3D%20%2Fdata%2Fmysql-ssl%2Fclient-cert.pem%20ssl-key%20%3D%20%2Fdata%2Fmysql-ssl%2Fclient-key.pem

踩过的坑之mysql连接报“Communications link failure”错误

其他报错情况:
问题解决:CDH6.3.1初始化scm_prepare_database数据库scm为空
CDH6.3.1初始化scm_prepare_database数据库scm为空

CDH集群手动导入scm库

太难咯~~

你可能感兴趣的:(报错,mysql)