安装hive+mysql
1、源码安装mysql
以root用户首先安装libaio-0.3.104.tar.gz
tar zxvf libaio-0.3.104.tar.gz
cd libaio-0.3.104
make prefix=/lib64 install
export LD_LIBRARY_PATH=/lib64/lib
解压mysql
tar zxvf mysql-5.5.29-linux2.6-x86_64.tar.gz
ln -s mysql-5.5.29-linux2.6-x86_64 mysql
cd mysql
执行 ./scripts/mysql_install_db --datadir=/home/hive/mysql/data --basedir=$PWD --user=hive
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/home/hive/mysql/bin/mysqladmin -u root password 'new-password'
/home/hive/mysql/bin/mysqladmin -u root -h hostname password 'new-password'
Alternatively you can run:
/home/hive/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /home/hive/mysql ; /home/hive/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /home/hive/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /home/hive/mysql/scripts/mysqlbug script!
看到以上信息安装成功
ln -s /home/hive/mysql/ /usr/local/mysql
防止以下报错:
默认会去寻找这个目录
首先需要将scripts/mysql.server服务脚本复制到/etc/init.d/,并重命名为mysqld。
cp support-files/mysql.server /etc/init.d/mysqld
通过chkconfig命令将mysqld服务加入到自启动服务项中。
chkconfig --add mysqld
chkconfig --list mysqld
./mysqld_safe --user=hive & 启动
2、为hive建立相应的mysql账号,并且赋予足够的权限 (http://www.cnblogs.com/fly1988happy/archive/2011/12/15/2288554.html)
./mysql -u root -p
create user 'hive' identified by 'hive';
grant all privileges on *.* to 'hive'@'localhost' with grant option;
测试登陆
./mysql -u hive -p
hive
成功登陆
3、建立hive专用的元数据库