Ubuntu18.04 linux系统安装JDK与Mysql的方法
平台部署
一、安装JDK
step1.下载OracleJDK
step2. 解压
step3. 加入环境变量
具体操作如下:
lemon@ubuntu:~$ cd ~/download/
lemon@ubuntu:~/download$ wget https://download.oracle.com/otn-pub/java/jdk/13.0.2+8/d4173c853231432d94f001e99d882ca7/jdk-13.0.2_linux-x64_bin.tar.gzlemon@ubuntu:~/download$ tar vxf jdk-8u191-linux-x64.tar.gz
lemon@ubuntu:~/download$ ls #查看当前目录下的文件
jdk1.8.0_191 jdk-8u191-linux-x64.tar.gz
lemon@ubuntu:~/download$ sudo mv jdk1.8.0_191/ /usr/local/jdk1.8/ #将jdk1.8.0_191文件夹移动到/usr/local/下并重命名为jdk1.8
lemon@ubuntu:~/download$ sudo vim /etc/profile #编辑环境变量
在环境变量末尾加入如下内容:
export JAVA_HOME=/usr/local/jdk1.8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=.:${JAVA_HOME}/bin:$PATH
保存后重新加载环境变量,使生效:
lemon@ubuntu:~/download$ source /etc/profile #刷新环境变量,使生效
lemon@ubuntu:~$ java -version#输入java -version,如显示以下信息,则JDK安装成功
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
二、安装MySQL
step1. 安装MySQL并配置
step2. 创建数据库与表
由于在安装Ubuntu系统时,本人选择了安装LAMP服务,所以MySQL已安装完成,仅需设置即可启用。
测试是否安装:
lemon@ubuntu:~$ mysql #输入mysql,如出现以下提示,说明已安装mysql
ERROR 1045 (28000): Access denied for user 'lemon'@'localhost' (using password: NO)
如未安装:
lemon@ubuntu:~$ sudo apt-get install mysql-server
lemon@ubuntu:~$sudo apt isntall mysql-client
lemon@ubuntu:~$sudo apt install libmysqlclient-dev
如已安装:
lemon@ubuntu:~$ sudo mysql_secure_installation
两者都会进入MySQL设置过程,具体设置内容如下:
#1
VALIDATE PASSWORD PLUGIN can be used to test passwords...
Press y|Y for Yes, any other key for No: N(不启用弱密码检查)
#2
Please set the password for root here...
New password: (设置root密码)
Re-enter new password: (重复输入)
#3
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them...
Remove anonymous users"_blank" href="https://www.jb51.net/database/710931.html">Navicat等软件,在其他计算机访问数据库了。
这样就Ok了
下一篇:Linux查看ip的实例方法