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

2022-09-07  本文已影响0人  Rinaloving
查看所有用户

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
上一篇下一篇

猜你喜欢

热点阅读