next up previous contents
Next: 刪除用戶 Up: 用戶管理 Previous: 建立用戶   Contents   DYWANG_HOME

查詢測試新用戶

  1. 列出剛剛新增的用戶的 host,user,password 欄位,其中密碼已經加密。
    mariadb root@localhost:mysql> select host,user,password from user where user='dy
                                  wang';                                            
    +-----------+--------+-------------------------------------------+
    | host      | user   | password                                  |
    +-----------+--------+-------------------------------------------+
    | localhost | dywang | *050376F3855A67F5E2C6514FD3130B31006C1276 |
    +-----------+--------+-------------------------------------------+
    
    1 row in set
    Time: 0.021s
    
  2. show grants 列出 用戶 dywang@localhost 的權限。
    mariadb root@localhost:(none)> show grants for 'dywang'@'localhost';                                                                                                         
    +-------------------------------------------------------------
    | Grants for dywang@localhost                                 
    +-------------------------------------------------------------
    | GRANT SELECT, INSERT, UPDATE ON *.* TO 'dywang'@'localhost' 
    +-------------------------------------------------------------
    -------------------------------------------------------------------+
                                                                       |
    -------------------------------------------------------------------+
    IDENTIFIED BY PASSWORD '*050376F3855A67F5E2C6514FD3130B31006C1276' |
    -------------------------------------------------------------------+
    
    1 row in set
    Time: 0.026s
    
  3. 退出 mariadb。
    mariadb root@localhost:(none)> quit;                                            
    Goodbye!
    
  4. 使用新用戶 dywang,密碼 123qwe,登入 mariadb 資料庫。
    [root@kvm8 ~]# mysql -udywang -p123qwe
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 31
    Server version: 10.3.11-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>
    
  5. 退出資料庫。
    MariaDB [(none)]> exit;
    Bye
    



De-Yu Wang 2020-04-07