hive安装需要安装mysql区别_HIVE安装系列之一:在Linux中安装mysql,为其作为hive的metastore做准备...
安裝mysql的Linux機器是Centos6的系統,機器名字叫combanc05
mysql我采用的是5.5版本。
安裝過程中需要解決新舊版的沖突問題,并允許mysql被遠程訪問。以便其作為hive的元數據倉庫順利運行。
下載到mysql
在linux中安裝mysql,
首先可以到官網去找Linux(Centos6.4)對應的mysql版本,也就是Red Hat對應的版本。
下載之后上傳到linux文件系統中。
解決新舊版本的沖突
只安裝server就可以,但是安裝client配置起來很方便。
#
用 rpm 來安裝
命令:rpm -ivh MySQL-server-5.5.31-2.el6.i686
i 安裝 instance
v 顯示詳情
h 顯示進度
#用 rpm來顯示查詢已經安裝的舊版本
命令:rpm -qa | grep mysql
命令:rpm -qa | grep MySQL
qa?將所有的rpm包都顯示出來。a=all
管道,過濾所有的mysql
#用rpm卸載已經安裝的舊版本。
命令:rpm -e mysql-libs-5.1.66-2.el6_3.i686
e=erase 擦除。
error: Failed dependencies:
libmysqlclient.so.16 is needed by (installed) postfix-2:2.6.6-2.2.el6_1.i686
libmysqlclient.so.16(libmysqlclient_16) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.i686
mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.i686
報錯了,說明有別的包依賴它。
#使用暴力的方式強制刪除
命令: rpm -e mysql-libs-5.1.66-2.el6_3.i686 --nodeps
#重新安裝一下mysql
命令: rpm -ivh MySQL-server-5.5.31-2.el6.i686
將安裝好的mysql初始化
---------------------安裝成功之后會有這么一段。----------------------------------
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h combanc04 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation??你可以用這個對mysql進行初始化
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.
-----------------------------------------------------------------------------------
#為安裝配置方便,我們要將client也安裝上去
命令:rpm -ivh MySQL-client-5.5.31-2.el6.i686
#提示用這條命名對mysql進行初始化/usr/bin/mysql_secure_installation
#命令:/usr/bin/mysql_secure_installation
初始化之前我們需要先啟動mysql server
---------------------初始化的時候會有如下的報錯-----------------------------------
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! ?PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. ?If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 2002 (HY000):
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'(2)
Enter current password for root (enter for none):
Aborting!
----------------------------------------------------------------------------------------
#為了解決這一錯誤,我們打開mysql安裝目錄/usr/share/mysql下的mysql.server文件
命令:vim?/usr/share/mysql/mysql.server
里面有這樣一段話。
# If you install MySQL on some other places than /usr, then you
# have to do one of the following things for this script to work:
#
#- Run this script from within the MySQL installation directory ?先這么辦,這個是好用的。
# - Create a /etc/my.cnf file with the following information:
# ? [mysqld]
# ? basedir=
# - Add the above to any other configuration file (for example ~/.my.ini)
# ? and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
# ? below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.
basedir=
datadir= -------------------------------------------------------------------------------------------------
我們跑到mysql的安裝目錄里面去啟動mysql
#跑到mysql的安裝目錄
命令: cd /usr/share/mysql
#在/usr/share/mysql下查看mysql是否啟動
命令:service mysql status
#在/usr/share/mysql文件夾下啟動mysql
命令:service ?mysql ?start
對mysql進行初始化
命令:/usr/bin/mysql_secure_installation
要設置root密碼為hadoop
要刪除匿名用戶
記得要允許用戶遠程連接。
#在mysql中運行一個授權語句,授權root用戶可以在任何主機上訪問mysql,用密碼hadoop
命令:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'hadoop' WITH GRANT OPTION;
如果root用戶可以在combanc03上訪問,則改成
'root'@'combanc03'就可以了。
如果你僅想操作hive庫下面的所有表則?*.*變成hive.* #在mysql中運行一個授權語句,授權root用戶可以在任何主機上訪問mysql,用密碼hadoop
命令:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'hadoop' WITH GRANT OPTION;
如果root用戶可以在combanc03上訪問,則改成
'root'@'combanc03'就可以了。
如果你僅想操作hive庫下面的所有表則?*.*變成hive.*
總結
以上是生活随笔為你收集整理的hive安装需要安装mysql区别_HIVE安装系列之一:在Linux中安装mysql,为其作为hive的metastore做准备...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Silverlight 2 应用程序部署
- 下一篇: 我的2008