'Create Anonymous user without password in mysql8

I need to create a anonymous user without password in mysql8

I run following command to create:

mysql> create user ''@'localhost';
ERROR 1396 (HY000): Operation CREATE USER failed for ''@'localhost'

I flush privileges

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Again I used create user command and this time getting different error:

mysql> create user ''@'localhost';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source