CM使用MySQL数据库预处理scm_prepare_database.sh执行报错:java.sql.SQLException: Access denied for user 'scm'@'hadoop101.com' (using password: YES)

1.报错提示:

[root@hadoop101 ~]# /opt/module/cm/cm-5.12.1/share/cmf/schema/scm_prepare_database.sh mysql cm -hhadoop101 -uroot -p000000 --scm-host hadoop101 scm scm scm
JAVA_HOME=/opt/module/jdk1.8.0_121
Verifying that we can write to /opt/module/cm/cm-5.12.1/etc/cloudera-scm-server
log4j:ERROR Could not find value for key log4j.appender.A
log4j:ERROR Could not instantiate appender named "A".
Creating SCM configuration file in /opt/module/cm/cm-5.12.1/etc/cloudera-scm-server
Executing:  /opt/module/jdk1.8.0_121/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/opt/module/cm/cm-5.12.1/share/cmf/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /opt/module/cm/cm-5.12.1/etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
log4j:ERROR Could not find value for key log4j.appender.A
log4j:ERROR Could not instantiate appender named "A".
[2019-08-14 15:27:09,565] INFO     0[main] - com.cloudera.enterprise.dbutil.DbCommandExecutor.parseSqlState(DbCommandExecutor.java) - Unable to login using supplied username/password.
[2019-08-14 15:27:09,591]ERROR    26[main] - com.cloudera.enterprise.dbutil.DbCommandExecutor$DbConnectionTestException.logError(DbCommandExecutor.java) - Error when connecting to database.
java.sql.SQLException: Access denied for user 'scm'@'hadoop101.com' (using password: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:928)
        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1750)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1290)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2493)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2526)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2311)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at com.cloudera.enterprise.dbutil.DbCommandExecutor.testDbConnection(DbCommandExecutor.java:253)
        at com.cloudera.enterprise.dbutil.DbCommandExecutor.main(DbCommandExecutor.java:138)
[2019-08-14 15:27:09,597]ERROR    32[main] - com.cloudera.enterprise.dbutil.DbCommandExecutor$DbConnectionTestException.logError(DbCommandExecutor.java) - Exiting with exit code 8
--> Error 8, giving up (use --force if you wish to ignore the error)

报错提示scm用户访问不了数据库,即scm权限问题

2.解决:

授权scm用户所有访问权限:

mysql> use mysql;
mysql> select User,Host,Password from user;
+------+-----------+-------------------------------------------+
| User | Host      | Password                                  |
+------+-----------+-------------------------------------------+
| root | %         | *DDA7B4594264195DA8BB303516D7EC5509B7B942 |
| scm  | hadoop101 | *45E6E3C68BDF1AC7EBB5C5A3BCBD5E9437B293BE |
+------+-----------+-------------------------------------------+
2 rows in set (0.00 sec)
mysql> show grants for scm;
+----------------------------------------------------------------------------------------------------+
| Grants for scm@% |
+----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'scm'@'%' IDENTIFIED BY PASSWORD '*45E6E3C68BDF1AC7EBB5C5A3BCBD5E9437B293BE' |
+----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> grant all privileges on *.* to'scm'@'%' identified by 'scm' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> show grants for scm;
+-------------------------------------------------------------------------------------------------------------------------------+
| Grants for scm@% |
+-------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'scm'@'%' IDENTIFIED BY PASSWORD '*45E6E3C68BDF1AC7EBB5C5A3BCBD5E9437B293BE' WITH GRANT OPTION |
+-------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> drop database cm;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit;

3.再次执行:

[root@hadoop101 ~]# /opt/module/cm/cm-5.12.1/share/cmf/schema/scm_prepare_database.sh mysql cm -hhadoop101 -uroot -pasdf1234 --scm-host hadoop101 scm scm scm
JAVA_HOME=/opt/module/jdk1.8.0_121
Verifying that we can write to /opt/module/cm/cm-5.12.1/etc/cloudera-scm-server
log4j:ERROR Could not find value for key log4j.appender.A
log4j:ERROR Could not instantiate appender named "A".
Creating SCM configuration file in /opt/module/cm/cm-5.12.1/etc/cloudera-scm-server
Executing:  /opt/module/jdk1.8.0_121/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/opt/module/cm/cm-5.12.1/share/cmf/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /opt/module/cm/cm-5.12.1/etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
log4j:ERROR Could not find value for key log4j.appender.A
log4j:ERROR Could not instantiate appender named "A".
[2019-08-14 15:50:54,732] INFO     0[main] - com.cloudera.enterprise.dbutil.DbCommandExecutor.testDbConnection(DbCommandExecutor.java) - Successfully connected to database.
All done, your SCM database is configured correctly!

log4j:ERROR Could not find value for key log4j.appender.A错误按照网上说法对root用户授最大权限,但是试了还是报,最终提示成功了就没管,如果有其他方法请指教!

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'  IDENTIFIED BY '000000'  WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

 

posted @ 2019-08-14 16:00  猫不夜行  阅读(5311)  评论(1编辑  收藏  举报