基本使用类 创建空用户后,使用非法用户名‘abcd’,密码用空用户的密码,连接成功 mysql> create user ''@'localhost' IDENTIFIED BY 'Test1234'; mysql> select user,host from mysql.user; ++ user host ++ root % localhost mysql.infoschema localhost mysql.session localhost mysql.sys localhost ++ mysql uabcd h127.0.0.1 P3306 pTest1234 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 37Server version: 8.0.22debug Source distribution 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> 如果空用户没有密码,则使用任意用户名即可免密登录数据库,并获得空用户所拥有的所有权限。示例: 存在无密码的空用户时,可以使用任意用户免密登录数据库。 mysql> create user ''@'localhost'; Query OK, 0 rows affected (8.87 sec) mysql> select user,host from mysql.user; ++ user host ++ root % localhost mysql.infoschema localhost mysql.session localhost mysql.sys localhost ++ mysql uabcd h127.0.0.1 P3306 Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 39Server version: 8.0.22debug Source distribution 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>