0

Executing the following command

MariaDB [(none)]> select distinct user from mysql.user;

results in

+-------------+
| User        |
+-------------+
| app_user    |
|             |
| test_u      |
| mariadb.sys |
| root        |
+-------------+
5 rows in set (0.001 sec)

So I have probably created a user with no name, correct? Perhaps by using a wrong syntax in the past. Question is how to drop the user? Something like the following doesn't seem to work:

MariaDB [(none)]> drop user ' ';
ERROR 1396 (HY000): Operation DROP USER failed for ' '@'%'
JeroenDV
  • 125
  • 2
  • 14

2 Answers2

0

drop is used to remove tables https://dev.mysql.com/doc/refman/8.0/en/drop-table.html, DROP TABLE User

Try DELETE FROM User WHERE User.user = ' '

AntG
  • 1,291
  • 2
  • 19
  • 29
  • Goin in the right direction I think. However I could not figure out to make it work for my situation as; `MariaDB [(none)]> DELETE FROM User WHERE User.user = ' ';` Results in `ERROR 1046 (3D000): No database selected` Connecting to a database first `MariaDB [company]> select distinct user from mysql.user; *SOME RESULTS*` `MariaDB [company]> DELETE FROM User WHERE User.user = ' '; ERROR 1146 (42S02): Table 'company.user' doesn't exist` – JeroenDV Dec 15 '21 at 11:43
0

After some trial and error I stumbled upon mysql.user does not exist. During the execution of mysql_secure_installation the terminal states

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!

So this ' ' user is equal to the anonymous user described here. Running select distinct user from mysql.user; after the removal of anonymous users.

Results in

+-------------+
| User        |
+-------------+
| app_user    |
| test_u      |
| mariadb.sys |
| root        |
+-------------+

So probably this ' ' user was already there.

JeroenDV
  • 125
  • 2
  • 14