解决虚拟机安装mysql8.*版本后安装hive过程中,MySQL无法用root登录问题,前文的解决安装比较麻烦还需新建用户在使用,
本篇文章详细介绍修改无法root登录问题,对比修改即可;
1.首先进入HIve安装的下面的hive-site.xml文件 编辑
vim hive-site.xml
将里边设置成root即可
2.启动MySQL
mysql -uroot -p
3.输入以下命令:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| hivedb |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (2.47 sec)
mysql> drop database hivedb;
Query OK, 74 rows affected (22.12 sec)
mysql> use mysql;
Database changed
mysql> select host,user from user where user='root';
+-----------+------+
| host | user |
+-----------+------+
| localhost | root |
+-----------+------+
1 row in set (0.00 sec)
mysql> update user set host='%' where user='root' and host='localhost';
Query OK, 1 row affected (0.08 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user from user where user='root';
+------+------+
| host | user |
+------+------+
| % | root |
+------+------+
1 row in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.39 sec)
mysql> exit;
Bye
4.退出MySQL数据库,输入命令:
schematool -initSchema -dbType mysql -verbose
5.然后登录hive,结束!