變更用戶密碼

  1. 使用 root 登入 mariadb。
    [root@kvm3 html]# mycli -uroot -p123qwe
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 12
    Server version: 10.11.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.
    
  2. 設定 dywang 密碼為 111111。
    MariaDB root@(none):mysql> set password for 'dywang'@'localhost' = password('1
                            -> 11111');
    Query OK, 0 rows affected
    Time: 0.014s
    
  3. 登出 mariadb。
    MariaDB root@(none):mysql> quit;
    Goodbye!
    
  4. dywang 使用密碼 111111 成功登入 mariadb。
    Connecting to socket /var/lib/mysql/mysql.sock, owned by user mysql
    MariaDB 10.11.11
    mycli 1.39.1
    Home: http://mycli.net
    Bug tracker: https://github.com/dbcli/mycli/issues
    Thanks to the contributor - QiaoHou Peng
    MariaDB dywang@(none):(none)>
    
  5. dywang 登出 mariadb。
    MariaDB dywang@(none):(none)> quit;
    Goodbye!