#----------tar jdk 安装------------
#解压 jdk-8u111-linux-x64.tar.gz
tar -zxvf jdk-8u111-linux-x64.tar.gz -C ../bigdata
#配置环境变量
vi /etc/profile
在done后添加
export JAVAHOME=/opt/bigdata/jdk180
export PATH=$JAVAHOME/bin:$PATH
export CLASSPATH=.:$JAVAHOME/lib/dt.jar:$JAVAHOME/lib/tools.jar
#激活环境变量配置
source /etc/profile
#检查配置结果
echo $JAVAHOME
java -version
#-----------rpm maria-mysql 安装-----------
#查看默认数据库
rpm -qa|grep mariadb
#删除默认数据库
yum [-y] remove xxx
#安装mysql的repo源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
#如果wget不能使用
yum [-y] install wget
#rpm安装mysql的rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
#yum安装mysql
yum -y install mysql-server
#查看安装结果
rpm -qa|grep mysql
一共五个
(主)mysql-community-server-5.6.48-2.el7.x86_64 服务器
依赖安装
mysql-community-client-5.6.48-2.el7.x86_64 客户端
mysql-community-release-el7.noarch
mysql-community-libs-5.6.48-2.el7.x86_64
mysql-community-common-5.6.48-2.el7.x86_64
#删除mysql
systemctl start/stop/restart/enable/disable mysqld
rpm -e mysql-community-client-5.6.48-2.el7.x86_64...
rpm -e mysql-community-server-5.6.48-2.el7.x86_64...
#尝试登陆(启动服务后首次登陆免密)
mysql -u root
#如果首次登陆报错:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock
#原因是当前用户没有var/lib/mysql目录的访问权限,解决方案:修改访问权限
chown -R root:mysql /var/lib/mysql
#重启mysql服务,并重新尝试登陆即可
service mysqld restart / systemctl restart mysqld
mysql -u root
#首次登陆有修改root密码,建议加上远程登录设置方便dos或java程序连接,退出重启服务后重进即可
use mysql;#进入系统存储用户信息的库
update user set password=password('root'), where user='root';
grant all on *.* to root@'%' idendified by 'kb08';
exit;
#--------忘记root密码-------
#找到mysql配置文件
cd /
find -name 'my.cnf'
vi /etc/my.cnf
[mysqld]
skip-grant-tables 免密登录
esc:wq!
systemctl restart mysql
#免密登录
mysql -u root 回车
#修改密码
update user set password=password('root') where user='root';
quit;/exit;/ctl+c
vi /etc/my.cnf
[mysqld]
skip-grant-tables 删除配置
esc:wq!
systemctl restart mysql
#正常登录
mysql -u root -p 回车输入密码