Get the App
SLTechnology News&Howtos  ›  Database  › 

How to solve the problem of ERROR 1396 (HY000) error in Mysql

Shulou Source: shulou.com Published: 2022-06-01 17:19:55 10月27日 Update

The following brings you about Mysql ERROR 1396 (HY000) error report how to solve, if you are interested, let's take a look at this article, I believe that after reading Mysql ERROR 1396 (HY000) error report how to solve how to help you more or less.

This error is reported when creating a user:

ERROR 1396 (HY000): Operation CREATE USER failed for 'abc'@'localhost'

The reason is that you already have this user in mysql. Delete the delete directly from the mysql.user, then refresh the permission FLUSH PRIVILEGES, and then create the user without this problem.

If it is drop user, the interior of mysql will be refreshed automatically, so there will be no such problem when it is rebuilt.

Give an example of 1--delete deletion:

Mysql > create user 'abc'@'localhost'

Query OK, 0 rows affected (0.00 sec)

Mysql > select user,host from user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | abc | localhost |

| | root | localhost |

+-+ +

3 rows in set (0.00 sec)

Mysql > delete from user where user='abc'

Query OK, 1 row affected (0.00 sec)

Mysql > select user,host from user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | root | localhost |

+-+ +

2 rows in set (0.00 sec)

Create a user with the same name again, and the error is as follows:

Mysql > create user 'abc'@'localhost'

ERROR 1396 (HY000): Operation CREATE USER failed for 'abc'@'localhost'

To refresh permissions here, you can create them after refreshing.

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Mysql > create user 'abc'@'localhost'

Query OK, 0 rows affected (0.00 sec)

Mysql > select user,host from user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | abc | localhost |

| | root | localhost |

+-+ +

3 rows in set (0.00 sec)

For example, to delete 2--drop, you can directly create:

Mysql > drop user 'abc'@'localhost'

Query OK, 0 rows affected (0.00 sec)

Mysql > select user,host from user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | root | localhost |

+-+ +

2 rows in set (0.00 sec)

Mysql > create user 'abc'@'loaclhost'

Query OK, 0 rows affected (0.00 sec)

Read the above about Mysql ERROR 1396 (HY000) error report how to solve the details, whether there is anything to gain. If you want to know more about it, you can continue to follow our industry information section.

Tags: Users permissions questions below interests content again reasons reports time more sections articles industry information errors help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Shulou Information vpn MariaDB Xiaomi