主頁(yè) > 知識(shí)庫(kù) > Ubuntu18.04 linux系統(tǒng)安裝JDK與Mysql的方法

Ubuntu18.04 linux系統(tǒng)安裝JDK與Mysql的方法

熱門(mén)標(biāo)簽:滴滴急救中心地圖標(biāo)注 申請(qǐng)400電話收費(fèi)標(biāo) 外呼線路隨意切換嗎 淘寶辦理400電話是多少 北海智能電銷(xiāo)機(jī)器人公司 艾澤拉斯地圖標(biāo)注 網(wǎng)絡(luò)電話外呼系統(tǒng)開(kāi)發(fā) 菏澤自動(dòng)電銷(xiāo)機(jī)器人公司 福州語(yǔ)音電銷(xiāo)機(jī)器人招商

平臺(tái)部署

一、安裝JDK

step1.下載OracleJDK
step2. 解壓
step3. 加入環(huán)境變量

具體操作如下:

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.gz

lemon@ubuntu:~/download$ tar vxf jdk-8u191-linux-x64.tar.gz
lemon@ubuntu:~/download$ ls #查看當(dāng)前目錄下的文件
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文件夾移動(dòng)到/usr/local/下并重命名為jdk1.8
lemon@ubuntu:~/download$ sudo vim /etc/profile #編輯環(huán)境變量

在環(huán)境變量末尾加入如下內(nèi)容:

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

保存后重新加載環(huán)境變量,使生效:

lemon@ubuntu:~/download$ source /etc/profile #刷新環(huán)境變量,使生效
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. 創(chuàng)建數(shù)據(jù)庫(kù)與表

由于在安裝Ubuntu系統(tǒng)時(shí),本人選擇了安裝LAMP服務(wù),所以MySQL已安裝完成,僅需設(shè)置即可啟用。

測(cè)試是否安裝:

lemon@ubuntu:~$ mysql #輸入mysql,如出現(xiàn)以下提示,說(shuō)明已安裝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

兩者都會(huì)進(jìn)入MySQL設(shè)置過(guò)程,具體設(shè)置內(nèi)容如下:

#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: (設(shè)置root密碼)
Re-enter new password: (重復(fù)輸入)

#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? (Press y|Y for Yes, any other key for No) : Y(不啟用匿名用戶(hù))

#4
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network...
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (不允許root遠(yuǎn)程登陸)

#5
By default, MySQL comes with a database named 'test' that
anyone can access...
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N

#6
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (立刻刷新權(quán)限表)

All done!

接下來(lái)進(jìn)入進(jìn)入MySQL進(jìn)行操作:

#最新版的MySQL安裝之后無(wú)法使用密碼進(jìn)行登陸,需要sudo登錄修改登錄方式
lemon@ubuntu:~$ sudo mysql -uroot -p
Enter password: (空密碼)
mysql>
mysql>UPDATE mysql.user SET authentication_string=PASSWORD('LEMON'), plugin='mysql_native_password' WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql>exit

lemon@ubuntu:~$ sudo service mysql restart
lemon@ubuntu:~$ mysql -u root -p
Enter password: (上一步設(shè)置的密碼,PASSWORD括號(hào)內(nèi)的)
mysql>CREATE DATABASE nutch;
mysql>USE nutch
mysql> CREATE TABLE `webpage` (
`id` varchar(767) NOT NULL,
`headers` blob,
`text` mediumtext DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`markers` blob,
`parseStatus` blob,
`modifiedTime` bigint(20) DEFAULT NULL,
`score` float DEFAULT NULL,
`typ` varchar(32) CHARACTER SET latin1 DEFAULT NULL,
`baseUrl` varchar(767) DEFAULT NULL,
`content` longblob,
`title` varchar(2048) DEFAULT NULL,
`reprUrl` varchar(767) DEFAULT NULL,
`fetchInterval` int(11) DEFAULT NULL,
`prevFetchTime` bigint(20) DEFAULT NULL,
`inlinks` mediumblob,
`prevSignature` blob,
`outlinks` mediumblob,
`fetchTime` bigint(20) DEFAULT NULL,
`retriesSinceFetch` int(11) DEFAULT NULL,
`protocolStatus` blob,
`signature` blob,
`metadata` blob,
`batchId`varchar(767)DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED
DEFAULT CHARSET=utf8mb4;
mysql>exit

*最新版本默認(rèn)情況下,MySQL是不允許遠(yuǎn)程登錄的,如需遠(yuǎn)程訪問(wèn)需要做一些修改:

lemon@ubuntu:~$sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
#將bind-address = 127.0.0.1注釋掉,重啟MySQL服務(wù)
lemon@ubuntu:~$sudo service mysqld start

接下來(lái)就可以通過(guò)Navicat等軟件,在其他計(jì)算機(jī)訪問(wèn)數(shù)據(jù)庫(kù)了。

這樣就Ok了

標(biāo)簽:滄州 賀州 亳州 丹東 混顯 資陽(yáng) 三沙 延安

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Ubuntu18.04 linux系統(tǒng)安裝JDK與Mysql的方法》,本文關(guān)鍵詞  Ubuntu18.04,linux,系統(tǒng),安裝,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Ubuntu18.04 linux系統(tǒng)安裝JDK與Mysql的方法》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于Ubuntu18.04 linux系統(tǒng)安裝JDK與Mysql的方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章