手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Hadoop之Hive本地与远程MySQL数据库管理模式安装手册

[日期:2012-11-25] 来源:Linux社区  作者:Leonarding [字体:大 中 小]

Windows              192.168.2.110          MySQL                  window7部署mysql

master上测试是否能成功连接远程mysql

[grid@h1 grid]$ ping 192.168.2.110

PING 192.168.2.110 (192.168.2.110) 56(84) bytes of data.

64 bytes from 192.168.2.110: icmp_seq=1 ttl=64 time=0.603 ms  是通的

64 bytes from 192.168.2.110: icmp_seq=2 ttl=64 time=0.283 ms

64 bytes from 192.168.2.110: icmp_seq=3 ttl=64 time=0.301 ms

--- 192.168.2.110 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2010ms

rtt min/avg/max/mdev = 0.283/0.395/0.603/0.148 ms

[grid@h1 grid]$mysql -h192.168.2.110 -uhive -phive

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


 

5.在mysql上创建hive数据库用于存放hive元数据(即数据字典)

查看mysql数据库软件中都存在哪些数据库,现在一共有6个

mysql> show databases;

+--------------------+

| Database          |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sakila            |

| test              |

| world              |

+--------------------+

6 rows in set (0.01 sec)

打开名为mysql的数据库,只有打开才能操作哦

mysql> use mysql;

Database changed                    按回车键出现Database changed时说明操作成功!

查看现在的数据库中存在什么表,一共有24张

mysql> show tables;

+---------------------------+

| Tables_in_mysql          |

+---------------------------+

| columns_priv              |

| db                        |

| event                    |

| func                      |

| general_log              |

| help_category            |

| help_keyword              |

| help_relation            |

| help_topic                |

| host                      |

| ndb_binlog_index          |

| plugin                    |

| proc                      |

| procs_priv                |

| proxies_priv              |

| servers                  |

| slow_log                  |

| tables_priv              |

| time_zone                |

| time_zone_leap_second    |

| time_zone_name            |

| time_zone_transition      |

| time_zone_transition_type |

| user                      |

+---------------------------+

24 rows in set (0.01 sec)

创建名为hive的库

mysql> create database hive;       

Query OK, 1 row affected (0.00 sec)

查看是否创建成功(查看mysql数据库软件中都存在哪些数据库)

mysql> show database;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1

mysql> show databases;

+--------------------+

| Database          |

+--------------------+

| information_schema |

|hive              |            这里已经创建hive库成功

| mysql              |

| performance_schema |

| sakila            |

| test              |

| world              |

+--------------------+

7 rows in set (0.00 sec)

打开名为hive的数据库

mysql> use hive;

Database changed

mysql> show tables;            检查hive库有哪些表,当然现在还没有创建目前没有表

Empty set (0.00 sec)

linux
相关资讯       Hadoop应用  Hadoop Hive MySQL  Hadoop Hive 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款