从 sql 数据库中删除没有名字的用户
Drop user without a name from sql database
正在执行以下命令
MariaDB [(none)]> select distinct user from mysql.user;
结果
+-------------+
| User |
+-------------+
| app_user |
| |
| test_u |
| mariadb.sys |
| root |
+-------------+
5 rows in set (0.001 sec)
所以我可能创建了一个没有名字的用户,对吗?也许是因为过去使用了错误的语法。问题是如何drop
用户?像下面这样的东西似乎不起作用:
MariaDB [(none)]> drop user ' ';
ERROR 1396 (HY000): Operation DROP USER failed for ' '@'%'
drop
用于删除表https://dev.mysql.com/doc/refman/8.0/en/drop-table.html、DROP TABLE User
尝试DELETE FROM User WHERE User.user = ' '
经过反复试验,我偶然发现了 mysql.user does not exist。在执行 mysql_secure_installation
期间,终端状态
By default, a MariaDB installation has an anonymous user, allowing
anyone to log into MariaDB without having to have a user account
created for them. This is intended only for testing, and to make the
installation go a bit smoother. You should remove them before moving
into a production environment.
Remove anonymous users? [Y/n] Y
... Success!
所以这个' '用户就是这里描述的匿名用户。 运行select distinct user from mysql.user;
删除匿名用户后
结果
+-------------+
| User |
+-------------+
| app_user |
| test_u |
| mariadb.sys |
| root |
+-------------+
所以这个“ ”用户可能已经在那里了。
正在执行以下命令
MariaDB [(none)]> select distinct user from mysql.user;
结果
+-------------+
| User |
+-------------+
| app_user |
| |
| test_u |
| mariadb.sys |
| root |
+-------------+
5 rows in set (0.001 sec)
所以我可能创建了一个没有名字的用户,对吗?也许是因为过去使用了错误的语法。问题是如何drop
用户?像下面这样的东西似乎不起作用:
MariaDB [(none)]> drop user ' ';
ERROR 1396 (HY000): Operation DROP USER failed for ' '@'%'
drop
用于删除表https://dev.mysql.com/doc/refman/8.0/en/drop-table.html、DROP TABLE User
尝试DELETE FROM User WHERE User.user = ' '
经过反复试验,我偶然发现了 mysql.user does not exist。在执行 mysql_secure_installation
期间,终端状态
By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? [Y/n] Y
... Success!
所以这个' '用户就是这里描述的匿名用户。 运行select distinct user from mysql.user;
删除匿名用户后
结果
+-------------+
| User |
+-------------+
| app_user |
| test_u |
| mariadb.sys |
| root |
+-------------+
所以这个“ ”用户可能已经在那里了。