<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # CentOS7 安裝 Mysql 5.7密碼查看與修改 ## 軟件版本 ``` CentOS release 6.9 (Final) mysql Client Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper mysql Server 5.7.18 ``` ## 檢測是否安裝MySQLServer 檢測下系統有沒有自帶的mysql:`yum list installed | grep mysql` 如果已經有的話執行命令 `yum -y remove mysql-libs.x86_64` 卸載已經安裝的 MySQL 。 ## 安裝 使用 rpm 包進行mysql服務器的安裝,具體下載地址在:https://dev.mysql.com/downloads/mysql/5.7.html#downloads ``` wget http://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql-community-server-5.7.18-1.el6.x86_64.rpm rpm -ivh mysql-community-server-5.7.18-1.el6.x86_64.rpm ``` ## 啟動 ``` service mysqld start ``` ## 查看密碼 安裝完成之后會自動在 `/var/log/mysqld.log` 中生成連接的密碼, 使用 `grep "temporary password" /var/log/mysqld.log` 命令查看生成的密碼。 初次登錄MySQL客戶端必須重新設置密碼才能進行數據的操作,如下: ``` [root@localhost src]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.7.18 Copyright (c) 2000, 2017, 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> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. ``` ## 密碼設置 不過需要注意的是現在MySQL已經強制要求強密碼,已經不能再用弱密碼比如“123456”了。如果你設置的密碼過于簡單,會提示錯誤: > ERROR 1819 (HY000): Your password does not satisfy the current policy requirements ### `set password` 命令 ``` SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); ``` ### `mysqladmin` 命令 ``` mysqladmin -u root password "newpass" # 如果root沒有設置密碼使用這種方式 mysqladmin -u root password oldpass "newpass" # 如果root設置了密碼使用這種方式 ``` ### 使用 `update` 語句 ``` UPDATE user SET authentication_string = PASSWORD('newpass') WHERE user = 'root'; ``` ## 忘記密碼 ``` mysqld_safe --skip-grant-tables& mysql -u root mysql mysql> UPDATE user SET authentication_string=PASSWORD("new password") WHERE user='root'; mysql> FLUSH PRIVILEGES; ``` ## 密碼復雜度的修改 ``` mysql> show variables like "validate_password%"; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password_check_user_name | OFF | | validate_password_dictionary_file | | | validate_password_length | 8 | # 必須8個字符以上 | validate_password_mixed_case_count | 1 | | validate_password_number_count | 1 | | validate_password_policy | MEDIUM | # 具體看下面的配置 | validate_password_special_char_count | 1 | +--------------------------------------+--------+ 7 rows in set (0.01 sec) mysql> SET GLOBAL validate_password_policy='LOW'; Query OK, 0 rows affected (0.00 sec) mysql> SET GLOBAL validate_password_length = 6; Query OK, 0 rows affected (0.00 sec) ``` * `LOW?`政策只測試密碼長度。 密碼必須至少有8個字符長。 * `MEDIUM?`政策的條件 密碼必須包含至少1數字字符,1 大寫和小寫字符,和1特別 (nonalphanumeric)字符。 * `STRONG?`政策的情況 密碼子字符串長度為4的或更長時間不能匹配 單詞在字典文件中,如果一個人被指定。 再進行密碼的修改試試。 ## 創建用戶并授權 ``` CREATE USER 'test'@'%' IDENTIFIED BY 'password'; GRANT ALL ON test.* TO 'test'@'%' WITH GRANT OPTION; ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看