亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Ubuntu18.04下安裝MySQL(圖文教程)

 更新時(shí)間:2019年10月22日 08:58:52   作者:OpsDrip  
這篇文章主要介紹了Ubuntu18.04下安裝MySQL的方法,本文圖文并茂給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

提示:以下操作均在root權(quán)限下進(jìn)行。

# 查看有沒有安裝MySQL:

dpkg -l | grep mysql

# 安裝MySQL:

apt install mysql-server

安裝完成之后可以使用如下命令來檢查是否安裝成功:

netstat -tap | grep mysql

通過上述命令檢查之后,如果看到有 mysql 的socket處于 LISTEN 狀態(tài)則表示安裝成功。

登錄mysql數(shù)據(jù)庫可以通過如下命令:

mysql -u root -p

-u 表示選擇登陸的用戶名, -p 表示登陸的用戶密碼,現(xiàn)在是mysql數(shù)據(jù)庫是沒有密碼的,Enter password:處直接回車,就能夠進(jìn)入mysql數(shù)據(jù)庫。

然后通過 show databases; 就可以查看當(dāng)前的所有數(shù)據(jù)庫。

接下來,為了確保數(shù)據(jù)庫的安全性和正常運(yùn)轉(zhuǎn),對(duì)數(shù)據(jù)庫進(jìn)行初始化操作。這個(gè)初始化操作涉及下面5個(gè)步驟。

(1)安裝驗(yàn)證密碼插件。

(2)設(shè)置root管理員在數(shù)據(jù)庫中的專有密碼。

(3)隨后刪除匿名賬戶,并使用root管理員從遠(yuǎn)程登錄數(shù)據(jù)庫,以確保數(shù)據(jù)庫上運(yùn)行的業(yè)務(wù)的安全性。

(4)刪除默認(rèn)的測試數(shù)據(jù)庫,取消測試數(shù)據(jù)庫的一系列訪問權(quán)限。

(5)刷新授權(quán)列表,讓初始化的設(shè)定立即生效。

對(duì)于上述數(shù)據(jù)庫初始化的操作步驟,在下面的輸出信息旁邊我做了簡單注釋。

root@ubuntu-virtual-machine:~# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin? #要安裝驗(yàn)證密碼插件嗎?

Press y|Y for Yes, any other key for No: N # 這里我選擇N
Please set the password for root here.

New password: #輸入要為root管理員設(shè)置的數(shù)據(jù)庫密碼

Re-enter new password: #再次輸入密碼

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. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y #刪除匿名賬戶
Success.

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) : N #禁止root管理員從遠(yuǎn)程登錄,這里我沒有禁止

... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y #刪除test數(shù)據(jù)庫并取消對(duì)它的訪問權(quán)限
- Dropping test database...
Success.

- Removing privileges on test database...
Success.

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)表,讓初始化后的設(shè)定立即生效
Success.

All done!

檢查mysql服務(wù)狀態(tài):

systemctl status mysql

顯示如下結(jié)果說明mysql服務(wù)運(yùn)行是正常的:

再次用mysql -u root -p命令,Enter password:處輸入剛設(shè)置的密碼,回車,就能夠進(jìn)入mysql數(shù)據(jù)庫。

使用 use mysql; 命令打開mysql命名的數(shù)據(jù)庫,顯示當(dāng)前數(shù)據(jù)庫的表:show tables; 查詢user表里的數(shù)據(jù):select * from user;(user表里是mysql數(shù)據(jù)庫的所有賬戶信息)

現(xiàn)在配置mysql允許遠(yuǎn)程訪問,首先編輯 /etc/mysql/mysql.conf.d/mysqld.cnf 配置文件:

vim /etc/mysql/mysql.conf.d/mysqld.cnf

注釋掉bind-address = 127.0.0.1

保存退出,然后進(jìn)入mysql數(shù)據(jù)庫,執(zhí)行授權(quán)命令:

mysql -u root -p
mysql> grant all on *.* to root@'%' identified by '你的密碼' with grant option;
mysql> flush privileges; # 刷新權(quán)限
mysql> exit

然后執(zhí)行exit命令退出mysql服務(wù),再執(zhí)行如下命令重啟mysql:

systemctl restartmysql

現(xiàn)在Windows下可以使用Navicat圖形化工具遠(yuǎn)程連接Ubuntu下的MySQL數(shù)據(jù)庫,輸入剛授權(quán)遠(yuǎn)程權(quán)限的密碼。

這里順便再分享下:Navicat for MySQL 10.1.7安裝包

鏈接: https://pan.baidu.com/s/12P1BcvQsRetBY0jGIvwILw&shfl=shareset 提取碼: 8bft

OK,到這里Ubuntu18.04下安裝MySQL已經(jīng)完成了。

操作過程中我遇到了以下錯(cuò)誤:

E: 無法獲得鎖 /var/lib/dpkg/lock-frontend - open (11: 資源暫時(shí)不可用)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

解決方法,參考自文章:http://chabaoo.cn/article/172460.htm

總結(jié)

以上所述是小編給大家介紹的Ubuntu18.04下安裝MySQL的方法,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

  • Linux下修改jar、zip等文件內(nèi)的文件詳解

    Linux下修改jar、zip等文件內(nèi)的文件詳解

    這篇文章主要介紹了Linux下修改jar、zip等文件內(nèi)的文件詳解的相關(guān)資料,需要的朋友可以參考下
    2017-03-03
  • Linux下一只五顏六色的「貓」

    Linux下一只五顏六色的「貓」

    這篇文章主要介紹了Linux下一只五顏六色的「貓」,在 Linux 下,此貓非彼貓,這里的 cat 并不代表貓,而是單詞 concatenate 的縮寫,主要給大家介紹了 ccat 的用法,需要的朋友可以參考下
    2020-07-07
  • centos下安裝配置phpMyAdmin的方法步驟

    centos下安裝配置phpMyAdmin的方法步驟

    本篇文章主要介紹了 centos下安裝配置phpMyAdmin的方法步驟,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-07-07
  • 關(guān)于Linux賬號(hào)管理詳解

    關(guān)于Linux賬號(hào)管理詳解

    本文主要針對(duì)Linux系統(tǒng)的賬戶管理方便的內(nèi)容做了詳細(xì)介紹,以及操作賬戶時(shí)的具體做法。
    2017-11-11
  • Linux下的fdisk命令用法詳解

    Linux下的fdisk命令用法詳解

    這篇文章主要介紹了Linux下的fdisk用法,大家都知道fdisk功能真的很強(qiáng)大,用它可以劃分出最復(fù)雜的分區(qū),本文重點(diǎn)給大家介紹Linux下的fdisk命令用法,感興趣的朋友一起看看吧
    2018-05-05
  • linux下安裝openssl、swoole等擴(kuò)展的詳細(xì)步驟

    linux下安裝openssl、swoole等擴(kuò)展的詳細(xì)步驟

    本文給大家詳細(xì)介紹了linux下安裝openssl、swoole等擴(kuò)展的,本文涉及到編譯安裝和yum安裝的知識(shí)點(diǎn),本文給大家介紹的非常詳細(xì),感興趣的朋友一起看看吧
    2016-10-10
  • linux Apache CGI 安裝配置

    linux Apache CGI 安裝配置

    Apache 中的提交了一種利用擴(kuò)展應(yīng)用程序執(zhí)行動(dòng)態(tài)網(wǎng)頁的機(jī)制. 稱為Common Gateway Interface (通用網(wǎng)關(guān)接口)簡稱CGI.
    2009-05-05
  • 詳解Linux下出現(xiàn)permission denied的解決辦法

    詳解Linux下出現(xiàn)permission denied的解決辦法

    這篇文章主要介紹了詳解Linux下出現(xiàn)permission denied的解決辦法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-02-02
  • Linux如何殺死指定端口的進(jìn)程

    Linux如何殺死指定端口的進(jìn)程

    這篇文章主要介紹了Linux如何殺死指定端口的進(jìn)程問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-04-04
  • Ubuntu16.04安裝clion全過程及步驟詳解

    Ubuntu16.04安裝clion全過程及步驟詳解

    這篇文章主要介紹了Ubuntu16.04安裝clion全過程及步驟詳解,clion是一款JetBrains 推出的全新的 C/C++ 跨平臺(tái)集成開發(fā)環(huán)境,在Ubuntu系統(tǒng)下使用方便,下面給大家分享操作步驟,需要的朋友可以參考下
    2020-08-08

最新評(píng)論