1.JDK下载安装
地址:https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
账号密码:https://blog.csdn.net/WNsshssm/article/details/84315519
(1)解压缩 tar -zxvf
(2)环境配置 命令 vim /etc/profile 修改配置文件
pwd获取jdk的路径,insert到配置文件的最下面。
#java environment
export JAVA_HOME=/opt/soft/jdk-8u281/jdk1.8.0_281
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
保存,source /etc/profile 使配置文件生效,查看是否安装配置成功。
2.MySQL安装
(1)本地yum仓库中没有可用的mysql-server rpm包,执行以下命令:
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
(2)开始安装
yum -y install mysql57-community-release-el7-10.noarch.rpm
(3)安装MySQL服务器
yum -y install mysql-community-server
(4)启动
systemctl start mysqld
(5)查看状态
systemctl status mysqld
(6)设置开机自动启动
systemctl enable mysql
(7)获取初始的密码,通过日志文件
grep "password" /var/log/mysqld.log
如果没有,则修改配置文件进行免密登录
vim /etc/my.cnf(window下是.ini)
添加一行:
skip-grant-tables
保存退出,重启MySQL:
systemctl restart mysqld
(8)登录
mysql -uroot -p
(9)修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
命令修改默认密码的复杂度:
set global validate_password_policy=LOW;
修改默认密码长度:
set global validate_password_length=6;
查看mysql默认密码复杂度:
SHOW VARIABLES LIKE 'validate_password%';
(10)远程开启权限(开启所有的,用%代替IP)
grant all privileges on *.* to 'root'@'ip' identified by 'password' with grant option;
(11)刷新配置
flush privileges;
(12)防火墙开启3306端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
(13)防火墙关闭和状态查询
systemctl stop firewalld.service
firewall-cmd --state