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

Hive+MySQL安装 配置 使用

[日期:2012-03-15] 来源:Linux社区  作者:Linux [字体:大 中 小]

更多Hive相关信息见 http://www.linuxidc.com/search.aspx?Where=Nkey&Keyword=Hive

1.下载MySQL 

1.  http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.55.tar.gz/from/http://mysql.ntu.edu.tw/  

2. 解压 

1.  tar -zxvf mysql-5.1.55.tar.gz  

3.安装 

1.  ./configure --prefix=/usr/local/mysql --localstatedir=/data/mysql/data --without-debug --with-charset=utf8 --with-extra-charsets=all --enable-assembler --with-pthread --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-big-tables --with-plugins=all  

2.    

3.  make && make install  

4.配置文件 
在/etc目录下,添加my.cnf 
安装好mysql后,在/usr/local/mysql/share/mysql目录下,会有my-huge.cnf,  my-medinum.cnf, my-small.cnf 

1.  [root@slave-003 mysql]# cp /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf  

如果你的内存≤64M,则复制/usr/local/share/mysql/my-small.cnf为/etc/my.cnf 
# This is for a system with little memory (<= 64M) where MySQL is only used 
# from time to time and it's important that the mysqld daemon 
# doesn't use much resources. 

如果内存是128M,则复制/usr/local/share/mysql/my-medium.cnf为/etc/my.cnf 
# This is for a system with little memory (32M - 64M) where MySQL plays 
# an important part, or systems up to 128M where MySQL is used together with 
# other programs (such as a web server) 

如果内存是512M,则复制/usr/local/share/mysql/my-large.cnf为/etc/my.cnf 
# This is for a large system with memory = 512M where the system runs mainly 
# MySQL. 

如果内存是1-2G,www.linuxidc.com则复制/usr/local/share/mysql/my-huge.cnf为/etc/my.cnf 
# This is for a large system with memory of 1G-2G where the system runs mainly 
# MySQL. 

5.
生成mysql用户数据库和表文件 

1.  /usr/local/mysql/bin/mysql_install_db --user=mysql  

会自动在localstatedir定义的路径生成文件 

6.
添加帐号 

1.  groupadd mysql  

2.  useradd -g mysql mysql  

7.修改权限 

1.  chown -R mysql:mysql /data/mysql/data  

2.  chmod 775 /data/mysql/data/  

8.启动mysql 

1.  /usr/local/mysql/bin/mysqld_safe &  

9.添加到系统的启动目录 

1.  cp /usr/local/mysql/share/mysql/mysql.server  /etc/init.d/mysql  

 

1.  /etc/init.d/mysql start  

2.  /etc/init.d/mysql stop  

3.  /etc/init.d/mysql restart  



10.
运行客户端 

1.  /usr/local/mysql/bin/mysql  

启动成功 
查询数据库 
mysql> show databases; 
+--------------------+ 
| Database           | 
+--------------------+ 
| information_schema | 
| mysql              | 
| test               | 
+--------------------+ 
3 rows in set (0.01 sec) 

linux
相关资讯       Hive  MySQL数据库教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

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