我只想解决我的问题[root@master hive]#
[root@master hive]# pkill mysqld
[2]- 退出 1 nohup /export/server/hive/bin/hive --service metastore > /export/server/hive/logs/metastore.log 2>&1
[root@master hive]# pkill mysqld_safe
[root@master hive]# 2025-11-26T15:10:03.340710Z mysqld_safe mysqld from pid file /export/server/mysql/mysql.pid ended
[1]- 完成 mysqld_safe --skip-grant-tables --skip-networking
[root@master hive]#
[root@master hive]# ps aux | grep mysql
root 23564 0.0 0.2 112824 972 pts/4 S+ 23:10 0:00 grep --color=auto mysql
[root@master hive]# /export/server/mysql/bin/mysqld_safe --skip-grant-tables --skip-networking --basedir=/export/server/mysql --datadir=/export/server/mysql/data &
[4] 23768
[root@master hive]# 2025-11-26T15:10:40.688895Z mysqld_safe Logging to '/export/server/mysql/data/error.log'.
2025-11-26T15:10:40.744255Z mysqld_safe Starting mysqld daemon with databases from /export/server/mysql/data
[root@master hive]# ps aux | grep mysqld
root 23768 0.2 0.0 113412 76 pts/4 S 23:10 0:00 /bin/sh /export/server/mysql/bin/mysqld_safe --skip-grant-tables --skip-networking --basedir=/export/server/mysql --datadir=/export/server/mysql/data
mysql 24013 8.7 23.5 1120852 113112 pts/4 Sl 23:10 0:02 /export/server/mysql/bin/mysqld --basedir=/export/server/mysql --datadir=/export/server/mysql/data --plugin-dir=/export/server/mysql/lib/plugin --user=mysql --skip-grant-tables --skip-networking --log-error=/export/server/mysql/data/error.log --pid-file=/export/server/mysql/mysql.pid --socket=/tmp/mysql.sock --port=3306
root 24658 0.0 0.2 112824 976 pts/4 S+ 23:11 0:00 grep --color=auto mysqld
[root@master hive]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.43 MySQL Community Server (GPL)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.17 sec)
mysql> UPDATE mysql.user SET
-> authentication_string = PASSWORD('123456'),
-> plugin = 'mysql_native_password'
-> WHERE User = 'root';
Query OK, 0 rows affected, 1 warning (0.04 sec)
Rows matched: 1 Changed: 0 Warnings: 1
mysql> -- 插入或更新远程访问权限
mysql> INSERT INTO mysql.user (Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv, Trigger_priv, Create_tablespace_priv)
-> VALUES ('%', 'root', 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
-> ON DUPLICATE KEY UPDATE
-> Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y',
-> Create_priv='Y', Drop_priv='Y', Grant_priv='Y', Super_priv='Y';
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
mysql>
mysql> -- 同样设置 localhost 和 master 主机
mysql> UPDATE mysql.user SET Host='localhost' WHERE User='root' AND Host='127.0.0.1';
Query OK, 0 rows affected (0.04 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> INSERT INTO mysql.user (Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Grant_priv, Super_priv) VALUES ('master', 'root', 'Y','Y','Y','Y','Y','Y','Y','Y') ON DUPLICATE KEY UPDATE Select_priv='Y';
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.05 sec)
mysql> EXIT;
Bye
[root@master hive]# pkill mysqld
[root@master hive]# pkill mysqld_safe
[root@master hive]# 2025-11-26T15:12:09.597886Z mysqld_safe mysqld from pid file /export/server/mysql/mysql.pid ended
[4]+ 完成 /export/server/mysql/bin/mysqld_safe --skip-grant-tables --skip-networking --basedir=/export/server/mysql --datadir=/export/server/mysql/data
[root@master hive]# # 查看端口监听情况
[root@master hive]# netstat -tuln | grep 3306
[root@master hive]# /export/server/mysql/bin/mysqld_safe --basedir=/export/server/mysql --datadir=/export/server/mysql/data &
[4] 26408
[root@master hive]# 2025-11-26T15:12:23.844308Z mysqld_safe Logging to '/export/server/mysql/data/error.log'.
2025-11-26T15:12:23.902108Z mysqld_safe Starting mysqld daemon with databases from /export/server/mysql/data
[root@master hive]# # 查看端口监听情况
[root@master hive]# netstat -tuln | grep 3306
tcp6 0 0 :::3306 :::* LISTEN
[root@master hive]# mysql -h 192.168.161.130 -u root -p -e "SHOW DATABASES;"
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'master' (using password: YES)
[root@master hive]# mysql -u root -p -e "
> DROP DATABASE IF EXISTS hive;
> CREATE DATABASE hive CHARACTER SET utf8 COLLATE utf8_general_ci;
> GRANT ALL PRIVILEGES ON hive.* TO 'root'@'%' IDENTIFIED BY '123456';
> GRANT ALL PRIVILEGES ON hive.* TO 'root'@'master' IDENTIFIED BY '123456';
> GRANT ALL PRIVILEGES ON hive.* TO 'root'@'localhost' IDENTIFIED BY '123456';
> FLUSH PRIVILEGES;
> "
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@master hive]# cd /export/server/hive
[root@master hive]# bin/schematool -dbType mysql -initSchema -verbose
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/server/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/root/export/server/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL: jdbc:mysql://192.168.161.130:3306/hive?createDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: root
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: java.sql.SQLException : Access denied for user 'root'@'master' (using password: YES)
SQL Error code: 1045
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
at org.apache.hadoop.hive.metastore.tools.HiveSchemaHelper.getConnectionToMetastore(HiveSchemaHelper.java:94)
at org.apache.hive.beeline.HiveSchemaTool.getConnectionToMetastore(HiveSchemaTool.java:169)
at org.apache.hive.beeline.HiveSchemaTool.testConnectionToMetastore(HiveSchemaTool.java:475)
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:581)
at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:567)
at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1517)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:318)
at org.apache.hadoop.util.RunJar.main(RunJar.java:232)
Caused by: java.sql.SQLException: Access denied for user 'root'@'master' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:864)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1707)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1217)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2220)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2015)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:768)
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:403)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:385)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:323)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at org.apache.hadoop.hive.metastore.tools.HiveSchemaHelper.getConnectionToMetastore(HiveSchemaHelper.java:88)
... 11 more
*** schemaTool failed ***
[root@master hive]#
最新发布