Fix: ERROR 1396 (HY000): Operation CREATE USER failed in MySQL?

MySQLMySQLi Database

To fix the error, let us see how to create a user correctly. Let us create a user −

mysql> create user 'Emma'@'localhost' IDENTIFIED BY 'emma_654';
Query OK, 0 rows affected (0.00 sec)

Let us display all users along with host −

mysql> select user,host from MySQL.user;

This will produce the following output. The new user created above is visible in the below list of all users along with host −

+------------------+-----------+
| user             |      host |
+------------------+-----------+
| Bob              |         % |
| Charlie          |         % |
| Robert           |         % |
| User2            |         % |
| mysql.infoschema |         % |
| mysql.session    |         % |
| mysql.sys        |         % |
| root             |         % |
| @UserName@       | localhost |
| Adam             | localhost |
| Adam Smith       | localhost |
| Chris            | localhost |
| David            | localhost |
| Emma             | localhost |
| Jace             | localhost |
| James            | localhost |
| John             | localhost |
| John Doe         | localhost |
| Michael          | localhost |
| Mike             | localhost |
| Robert           | localhost |
| User1            | localhost |
| am               | localhost |
| hbstudent        | localhost |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
+------------------+-----------+
26 rows in set (0.00 sec)
raja
Published on 30-Dec-2019 07:02:32
Advertisements