美文网首页
mysql 查看所有用户并授权指定用户创建数据库权限

mysql 查看所有用户并授权指定用户创建数据库权限

作者: Rinaloving | 来源:发表于2022-09-07 14:28 被阅读0次
    查看所有用户
    
    C:\Users\Administrator>mysql -u root -p
    Enter password: ****
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 9
    Server version: 8.0.22 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2020, 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> use mysql
    Database changed
    mysql> select user from user
        -> ;
    +------------------+
    | user             |
    +------------------+
    | Uplus            |
    | mysql.infoschema |
    | mysql.session    |
    | mysql.sys        |
    | root             |
    +------------------+
    5 rows in set (0.00 sec)
    
    mysql>
    
    
    
    授权数据库给用户:
    mysql> create database siemensmeetting2
        -> ;
    Query OK, 1 row affected (0.07 sec)
    
    mysql> GRANT  ALL PRIVILEGES ON siemensmeetting2.* TO 'Uplus'@'localhost' ;
    Query OK, 0 rows affected (0.04 sec)
    
    mysql>
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.03 sec)
    
    mysql>
    
    mysql> exit;
    Bye
    
    
    
    效果:
    数据库.png

    相关文章

      网友评论

          本文标题:mysql 查看所有用户并授权指定用户创建数据库权限

          本文链接:https://www.haomeiwen.com/subject/frlonrtx.html