真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Ubuntu中如何安裝JDK與Mysql

這篇文章主要介紹“Ubuntu中如何安裝JDK與MySQL”,在日常操作中,相信很多人在Ubuntu中如何安裝JDK與Mysql問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Ubuntu中如何安裝JDK與Mysql”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!

專注于為中小企業(yè)提供成都網(wǎng)站設(shè)計、做網(wǎng)站、成都外貿(mào)網(wǎng)站建設(shè)公司服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)牟定免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了近1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

一、安裝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文件夾移動到/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ù)庫與表

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

測試是否安裝:

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

兩者都會進(jìn)入mysql設(shè)置過程,具體設(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(不啟用匿名用戶)

#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!

接下來進(jìn)入進(jìn)入mysql進(jìn)行操作:

#最新版的mysql安裝之后無法使用密碼進(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括號內(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)程訪問需要做一些修改:

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

接下來就可以通過navicat等軟件,在其他計算機(jī)訪問數(shù)據(jù)庫了。

Ubuntu中如何安裝JDK與Mysql

到此,關(guān)于“Ubuntu中如何安裝JDK與Mysql”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
當(dāng)前文章:Ubuntu中如何安裝JDK與Mysql
文章分享:http://weahome.cn/article/pojojj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部