五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

ubuntu中安裝mysql

2023-04-26 22:40 作者:青陽(yáng)小棧  | 我要投稿

## 先決條件


確保您以具有sudo特權(quán)的用戶身份登錄。


## 在Ubuntu上安裝MySQL


在撰寫(xiě)本文時(shí),Ubuntu存儲(chǔ)庫(kù)中可用的MySQL的最新版本是MySQL 8.0。要安裝它,請(qǐng)運(yùn)行以下命令:


```

sudo apt update

sudo apt install mysql-server

```


安裝完成后,MySQL服務(wù)將自動(dòng)啟動(dòng)。要驗(yàn)證MySQL服務(wù)器正在運(yùn)行,請(qǐng)輸入:


```

sudo systemctl status mysql

```


輸出應(yīng)顯示該服務(wù)已啟用并正在運(yùn)行:


```

● mysql.service - MySQL Community Server

?Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)

?Active: active (running) since Tue 2020-04-28 20:59:52 UTC; 10min ago

?Main PID: 8617 (mysqld)

?Status: "Server is operational"

?...

```


## 保護(hù)MySQL


MySQL安裝隨附一個(gè)名為的腳本`mysql_secure_installation`,可讓您輕松提高數(shù)據(jù)庫(kù)服務(wù)器的安全性。


調(diào)用不帶參數(shù)的腳本:


```

sudo mysql_secure_installation

```


系統(tǒng)將要求您配置`VALIDATE PASSWORD PLUGIN`用來(lái)測(cè)試MySQL用戶密碼強(qiáng)度并提高安全性的密碼:


```

Securing the MySQL server deployment.


Connecting to MySQL using a blank password.


VALIDATE PASSWORD COMPONENT 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 component?


Press y|Y for Yes, any other key for No: y

```


密碼驗(yàn)證策略分為三個(gè)級(jí)別:低,中和強(qiáng)。按下`y`如果你想設(shè)置的驗(yàn)證密碼插件或任何其他鍵移動(dòng)到下一個(gè)步驟:


```

There are three levels of password validation policy:


LOW Length >= 8

MEDIUM Length >= 8, numeric, mixed case, and special characters

STRONG Length >= 8, numeric, mixed case, special characters and dictionary file


Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2

```


在下一個(gè)提示符下,將要求您設(shè)置MySQL root用戶的密碼:


```

Please set the password for root here.



New password:?


Re-enter new password:?

```


如果您設(shè)置了驗(yàn)證密碼插件,該腳本將向您顯示新密碼的強(qiáng)度。鍵入`y`以確認(rèn)密碼:


```

Estimated strength of the password: 50?

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

```


接下來(lái),將要求您刪除匿名用戶,限制root用戶對(duì)本地計(jì)算機(jī)的訪問(wèn),刪除測(cè)試數(shù)據(jù)庫(kù)并重新加載特權(quán)表。您應(yīng)該回答`y`所有問(wèn)題。


## 以root身份登錄


要從命令行與MySQL服務(wù)器進(jìn)行交互,請(qǐng)使用MySQL客戶端實(shí)用程序,該實(shí)用程序是作為MySQL服務(wù)器軟件包的依賴項(xiàng)安裝的。


在MySQL 8.0上,`auth_socket`默認(rèn)情況下,root用戶通過(guò)插件進(jìn)行身份驗(yàn)證。


該`auth_socket`插件對(duì)`localhost`通過(guò)Unix套接字文件從進(jìn)行連接的用戶進(jìn)行身份驗(yàn)證。這意味著您不能通過(guò)提供密碼來(lái)以root用戶身份進(jìn)行身份驗(yàn)證。


要以root用戶身份登錄到MySQL服務(wù)器,請(qǐng)輸入:


```

sudo mysql

```


將為您提供MySQL Shell,如下所示:


```

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 8.0.19-0ubuntu5 (Ubuntu)


Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql>

```


如果要使用外部程序(例如phpMyAdmin)以root用戶身份登錄到MySQL服務(wù)器,則有兩個(gè)選擇。


第一個(gè)是將身份驗(yàn)證方法從更改`auth_socket`為`mysql_native_password`。您可以通過(guò)運(yùn)行以下命令來(lái)做到這一點(diǎn):


```

mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'very_strong_password';

mysql > FLUSH PRIVILEGES;

```


推薦的第二個(gè)選項(xiàng)是創(chuàng)建一個(gè)新的專用管理用戶,該用戶可以訪問(wèn)所有數(shù)據(jù)庫(kù):


```

GRANT ALL PRIVILEGES ON *.* TO 'administrator'@'localhost' IDENTIFIED BY 'very_strong_password';

```


## 結(jié)論


我們已經(jīng)向您展示了如何在Ubuntu 20.04上安裝MySQL?,F(xiàn)在您的數(shù)據(jù)庫(kù)服務(wù)器已啟動(dòng)并正在運(yùn)行


ubuntu中安裝mysql的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
银川市| 宁安市| 刚察县| 广平县| 汉中市| 大渡口区| 九龙坡区| 青州市| 新沂市| 容城县| 正安县| 鄂托克前旗| 中方县| 长汀县| 威宁| 偃师市| 金华市| 石门县| 开封县| 河间市| 阜阳市| 宁陵县| 吉安市| 苍溪县| 成武县| 托里县| 石屏县| 武义县| 北海市| 沅江市| 南皮县| 随州市| 舒城县| 白城市| 璧山县| 监利县| 合山市| 杭州市| 涞水县| 资阳市| 基隆市|