1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| 执行测试 [root@docker101 ~]# docker exec -it mysql-server mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.36 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
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> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | haha | | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.00 sec)
mysql> SELECT USER,host FROM mysql.user; +------------------+-----------+ | USER | host | +------------------+-----------+ | ha | % | | root | % | | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | +------------------+-----------+ 6 rows in set (0.01 sec)
mysql> SHOW GRANTS FOR ha; +----------------------------------------------+ | Grants for ha@% | +----------------------------------------------+ | GRANT USAGE ON *.* TO `ha`@`%` | | GRANT ALL PRIVILEGES ON `haha`.* TO `ha`@`%` | +----------------------------------------------+ 2 rows in set (0.00 sec)
mysql>
|