20220618Linux服务器安装JDK和Mysql

本文详细介绍了如何在Linux服务器上安装JDK,包括验证Java是否已安装、安装OpenJDK、设置JAVA_HOME环境变量,并提供了两种设置方法。接着,文章讲解了安装特定版本Java的步骤。随后,文章转向MySQL的安装,包括启动MySQL、查看运行状态、获取临时密码、修改root密码、设置密码策略、开放防火墙端口等操作。最后,文章提到了如何在Java环境中卸载MySQL。
摘要由CSDN通过智能技术生成

Verify Java is Installed on Your System

java –version
Install OpenJDK
sudo yum update

//Update the package repository to ensure you download the latest software

Then, install the JDK or JRE with the following command:

//JDK  8&11
sudo yum install java-1.8.0-openjdk-devel
sudo yum install java-11-openjdk-devel

//JRE  8&11
sudo yum install java-1.8.0-openjdk
sudo yum install java-11-openjdk-devel

Install Specific Version of Java

Run a command that shows all the installed versions on your computer:

sudo alternatives --config java

sudo update-alternatives --config java

image-20220618033637509

The image above shows that there are two alternatives to this system. These choices are represented by numbers 1 (Java 11) and 2 (Java 8).

To change the default version, type the associated number (in this case, 1 or 2) and press Enter.

Set JAVA_HOME Environment Variable On Linux

/usr/lib/jvm/java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值