主頁(yè) > 知識(shí)庫(kù) > 一鍵安裝mysql5.7及密碼策略修改方法

一鍵安裝mysql5.7及密碼策略修改方法

熱門標(biāo)簽:湘潭電銷機(jī)器人咨詢電話 高德地圖標(biāo)注模式 外呼系統(tǒng)服務(wù) 高德地圖標(biāo)注中心個(gè)人注冊(cè) 電銷機(jī)器人針對(duì)的 外呼系統(tǒng)防封號(hào)違法嗎 如何在高德地圖標(biāo)注新地址 寶應(yīng)電信400電話辦理費(fèi)用 400電話辦理都選易號(hào)網(wǎng)

一、一鍵安裝Mysql腳本

[root@uat01 ~]# cat InstallMysql01.sh 
#!/bin/bash
#2018-10-13
#旅行者-Travel
#1.安裝wget
yum -y install wget
#2、下載mysql的yum源
URL="https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm"
wget $URL -P /etc/yum.repos.d/
yum -y install yum-utils #如果沒(méi)有該包,下邊執(zhí)行yum-config-manager不生效
yum -y install /etc/yum.repos.d/mysql80-community-release-el7-1.noarch.rpm
 if [ $? -eq 0 ];then
  rm -rf /etc/yum.repos.d/mysql80-community-release-el7-1.noarch*
 fi
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
yum -y install mysql-community-server
 sleep 5
 systemctl start mysqld 
 systemctl enable mysqld
 systemctl status mysqld
 if [ $? -eq 0 ];then
  echo -e "install succefull"
  result="`grep 'temporary password' /var/log/mysqld.log`"
  p1="`echo $result |awk '{print $NF}'`"
  echo "數(shù)據(jù)庫(kù)密碼為:$p1"
 
 fi
[root@uat01 ~]# 

二、修改策略和密碼

執(zhí)行完以上腳本可以看到Mysql的密碼,如下方法登錄修改策略,因?yàn)槟J(rèn)密碼要求比較高,可以根據(jù)自己需求來(lái)決定是否更改策略:

install succefull
數(shù)據(jù)庫(kù)密碼為:9aTRok>f;1K
[root@uat01 ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23

Copyright (c) 2000, 2018, 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> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)

mysql> alter user 'root'@'localhost' identified by 'Yanglt123.';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit

三、數(shù)據(jù)庫(kù)密碼策略:

1、查看數(shù)據(jù)庫(kù)策略:

因?yàn)樯衔囊呀?jīng)將 validate_password_length 值改為4,所以下文顯示為4,默認(rèn)情況下為8

[root@uat01 ~]# mysql -uroot -p
.....
Server version: 5.7.23 MySQL Community 
......
mysql> show variables like 'validate_password%';
+--------------------------------------+-------+
| Variable_name      | Value |
+--------------------------------------+-------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file |  |
| validate_password_length    | 4  |
| validate_password_mixed_case_count | 1  |
| validate_password_number_count  | 1  |
| validate_password_policy    | LOW |
| validate_password_special_char_count | 1  |
+--------------------------------------+-------+
7 rows in set (0.00 sec)

mysql> 

2、各項(xiàng)值說(shuō)明

validate_password_policy:密碼安全策略,默認(rèn)MEDIUM策略

策略 檢查規(guī)則
0 or LOW Length
1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
2 or STRONG Length; numeric, lowercase/uppercase, and special characters; dictionary file

validate_password_dictionary_file:密碼策略文件,策略為STRONG才需要

validate_password_length:密碼最少長(zhǎng)度 ,測(cè)試發(fā)現(xiàn)最小值得為4。

validate_password_mixed_case_count:大小寫(xiě)字符長(zhǎng)度,至少1個(gè)

validate_password_number_count :數(shù)字至少1個(gè)

validate_password_special_char_count:特殊字符至少1個(gè)

3、修改策略,跟上文第二操作一樣

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec),
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

4、修改簡(jiǎn)單密碼測(cè)試

mysql> alter user 'root'@'localhost' identified by '1234'; #測(cè)試發(fā)現(xiàn)密碼長(zhǎng)度最少為4位
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye
[root@uat01 ~]# mysql -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.23 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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> 

總結(jié)

以上所述是小編給大家介紹的一鍵安裝mysql5.7及密碼策略修改方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家大家的!

您可能感興趣的文章:
  • MySQL5.7.20解壓版安裝和修改root密碼的教程
  • MySQL5.7.21安裝與密碼圖文配置教程
  • Windows10下MySQL5.7.19安裝教程 MySQL忘記root密碼修改方法
  • Centos7.3下mysql5.7.18安裝并修改初始密碼的方法
  • mysql5.7.18安裝并修改初始密碼的方法
  • Mysql5.7.14安裝配置方法操作圖文教程(密碼問(wèn)題解決辦法)
  • MySQL5.7安裝過(guò)程并重置root密碼的方法(shell 腳本)

標(biāo)簽:佛山 馬鞍山 蘭州 賀州 黃山 黔南 南充 宿遷

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《一鍵安裝mysql5.7及密碼策略修改方法》,本文關(guān)鍵詞  一鍵,安裝,mysql5.7,及,密碼,;如發(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)文章
  • 下面列出與本文章《一鍵安裝mysql5.7及密碼策略修改方法》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于一鍵安裝mysql5.7及密碼策略修改方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章