刪除用戶

  1. 先新增用戶 dywtest。
    [root@kvm6 ~]# mycli -uroot -S /var/lib/mysql/mysql.sock -p123qwe mysql
    mysql 5.5.49
    mycli 1.19.0
    Chat: https://gitter.im/dbcli/mycli
    Mail: https://groups.google.com/forum/#!forum/mycli-users
    Home: http://mycli.net
    Thanks to the contributor - Johannes Hoff
    mysql root@localhost:mysql> INSERT INTO user (host,user,password,select_priv,ins
                                ert_priv,update_priv) VALUES ('localhost','dywtest',
                                password('123qwe'),'Y','Y','Y');                    
    Query OK, 1 row affected
    Time: 0.003s
    mysql root@localhost:mysql> Flush privileges;                                   
    Query OK, 0 rows affected
    Time: 0.001s
    
  2. 退出資料庫。
    mysql root@localhost:mysql> exit;
    Goodbye!
    
  3. 再登入 mysql 刪除 dywtest。
    [root@kvm6 ~]# mycli -uroot -S /var/lib/mysql/mysql.sock -p123qwe mysql
    mysql 5.5.49
    mycli 1.19.0
    Chat: https://gitter.im/dbcli/mycli
    Mail: https://groups.google.com/forum/#!forum/mycli-users
    Home: http://mycli.net
    Thanks to the contributor - Ryan Smith
    mysql root@localhost:mysql> DROP USER 'dywtest'@'localhost';                    
    You're about to run a destructive command.
    Do you want to proceed? (y/n): y
    Your call!
    Query OK, 0 rows affected
    Time: 0.002s
    mysql root@localhost:mysql> exit;                                               
    Goodbye!