博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hadoop生态搭建(3节点)-05.mysql配置_单节点
阅读量:6333 次
发布时间:2019-06-22

本文共 3895 字,大约阅读时间需要 12 分钟。

# ==================================================================node1 

# ==================================================================安装 mysql

# 查看当前安装的mariadb包rpm -qa | grep mariadb# 有就将它们统统强制性卸载掉:rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64rpm -qa | grep -i mysql# 创建用户组和用户groupadd mysqluseradd -r -g mysql -s /bin/false mysql# 解压到指定目录tar -zxvf ~/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/localmv /usr/local/mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/mysqlrm –r ~/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

# ==================================================================环境变量

vi /etc/profile# 在export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL下添加export JAVA_HOME=/usr/java/jdk1.8.0_111export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.12export HADOOP_HOME=/usr/local/hadoop-2.7.6export MYSQL_HOME=/usr/local/mysqlexport PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$ZOOKEEPER_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$MYSQL_HOME/binexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport HADOOP_INSTALL=$HADOOP_HOMEexport HADOOP_MAPRED_HOME=$HADOOP_HOMEexport HADOOP_COMMON_HOME=$HADOOP_HOMEexport HADOOP_HDFS_HOME=$HADOOP_HOMEexport YARN_HOME=$HADOOP_HOMEexport HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native# 使环境变量生效source /etc/profile# 查看配置结果echo $MYSQL_HOME

# ==================================================================配置 mysql

mkdir $MYSQL_HOME/datamkdir $MYSQL_HOME/runmkdir $MYSQL_HOME/logs# mkdir /var/lib/mysqlvi /etc/my.cnf[client]default-character-set=utf8# character-set-client=utf8loose-default-character-set=utf8port=3306# socket=/var/lib/mysql/mysql.socksocket=/usr/local/mysql/mysql.sock[mysqld]server_id=1port=3306character_set_server=utf8init_connect='SET NAMES utf8'basedir=/usr/local/mysqldatadir=/usr/local/mysql/data# socket=/var/lib/mysql/mysql.socksocket=/usr/local/mysql/mysql.sock#不区分大小写lower_case_table_names=1log-error=/usr/local/mysql/logs/mysqld.logpid-file=/usr/local/mysql/run/mysqld.piddefault_storage_engine=InnoDBslow_query_log=1slow_query_log_file=/usr/local/mysql/logs/mysql_slow_query.loglong_query_time=5# chmod 777 /var/lib/mysqlchown -R mysql:mysql $MYSQL_HOME# 添加开机启动cp $MYSQL_HOME/support-files/mysql.server /etc/rc.d/init.d/mysqldvi /etc/rc.d/init.d/mysqldbasedir=/usr/local/mysqldatadir=/usr/local/mysql/data# 增加mysqld服务控制脚本执行权限chmod +x /etc/rc.d/init.d/mysqld# 将mysqld服务加入到系统服务chkconfig --add mysqld# 检查mysqld服务是否已经生效chkconfig --list mysqld# 初始化数据库$MYSQL_HOME/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data# 生成了临时密码# 执行以下命令创建RSA private key $MYSQL_HOME/bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/datagrep 'temporary password' /usr/local/mysql/logs/mysqld.log# 启动mysqlsystemctl start mysqld.service# service mysqld start# 启动数据库# ./mysqld_safe --user=mysql &;mysql -uroot -p# 如果出现错误 需要添加软连接# ln -s /usr/local/mysql/bin/mysql /usr/bin# 修改密码> alter user 'root'@'localhost' identified by '123456';> flush privileges;# 无法远程连接时> use mysql;> update user set host = '%' where user = 'root';> select host, user from user;# 如果要安装Hive,再创建Hive数据库和用户 再执行下面的语句 > create database hive character set utf8 ; > create user 'hive'@'%'identified by 'Hive-123'; > grant all privileges on *.* to 'hive'@'%'; > flush privileges;
show databases;quit;reboot# 重启验证有效后再进行快照mysql -uroot -pquit;shutdown -h now# mysql

 

 

# ==================================================================安装 mysql (windows)

 

my.ini[mysqld]server-id=1max_connections=2000character-set-server = utf8port=3306#skip-grant-tablesinnodb_file_per_table=0innodb_flush_log_at_trx_commit=0# dos下注册服务mysqld --defaults-file=my.ini --initialize-insecure# 安装mysqld --install mysql57# 启动服务net start mysql57mysql -u root -p> use mysql;> update user set authentication_string=password('123456') where user='root';> flush privileges;> exit

 

转载于:https://www.cnblogs.com/zcf5522/p/9754735.html

你可能感兴趣的文章
ListView 取消点击效果
查看>>
降级论
查看>>
wampServer连接oracle
查看>>
CentOS 6.5下编译安装新版LNMP
查看>>
Android Picasso
查看>>
top命令
查看>>
javascript的作用域
查看>>
新形势下初创B2B行业网站如何经营
查看>>
初心大陆-----python宝典 第五章之列表
查看>>
java基础学习2
查看>>
sysbench使用笔记
查看>>
有关电子商务信息的介绍
查看>>
NFC·(近距离无线通讯技术)
查看>>
多线程基础(三)NSThread基础
查看>>
PHP的学习--Traits新特性
查看>>
ubuntu下,py2,py3共存,/usr/bin/python: No module named virtualenvwrapper错误解决方法
查看>>
Ext.form.field.Number numberfield
查看>>
Linux文件夹分析
查看>>
解决部分月份绩效无法显示的问题:timestamp\union al\autocommit等的用法
查看>>
nginx 域名跳转 Nginx跳转自动到带www域名规则配置、nginx多域名向主域名跳转
查看>>