首先上传jdk-8u11-linux-x64.tar.gz包到root目录
网盘提取码:hst0
ssh登陆服务器
mkdir /usr/local/java
cp /root/jdk-8u11-linux-x64.tar.gz /usr/local/java/
cd /usr/local/java/
tar xvf jdk-8u11-linux-x64.tar.gz
vi /etc/profile
在尾部加入
export JAVA_HOME=/usr/local/java/jdk1.8.0_11
export JRE_HOME=/usr/local/java/jdk1.8.0_11/jre
export PATH=$PATH:/usr/local/java/jdk1.8.0_11/bin
export CLASSPATH=./:/usr/local/java/jdk1.8.0_11/lib:/usr/local/java/jdk1.8.0_11/jre/lib
重启服务器执行java -version
表示安装成功。
下面安装mysql5.7
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum install mysql-community-server --nogpgcheck
注意带上–nogpgcheck
设置开机启动mysql服务
systemctl enable mysqld
systemctl daemon-reload
查看mysql启动状态
systemctl status mysqld.service
表示启动成功
查看MySQL初始密码,这个密码是随机生成的
grep 'A temporary password' /var/log/mysqld.log
// 重制密码
会有弱密码提示,建议设置复杂点或者自己配置关闭
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
开启log_bin
查看是否开启
show variables like '%log_bin%';
以上图片成功的开启
没有
vi /etc/my.cnf
末尾加入
#开启并指定二进制日志前缀
log-bin=mysql_bin
#唯一id
server-id=11313
#二进制日志保存时间
expire_logs_days=7
binlog_format=ROW
保存重启mysql
systemctl restart mysqld.service