Home >Database >Mysql Tutorial >Why Does Recreating MySQL User 'jack'@'localhost' Fail with Error 1396?

Why Does Recreating MySQL User 'jack'@'localhost' Fail with Error 1396?

Linda Hamilton
Linda HamiltonOriginal
2024-12-20 19:31:10730browse

Why Does Recreating MySQL User 'jack'@'localhost' Fail with Error 1396?

Recreating MySQL User 'jack'@'localhost' Error 1396

Question:

Despite recreating a MySQL user as root, the operation fails with error 1396. The user was previously deleted from mysql.user, but no traces remain in the table. Creating other users works successfully, but recreating 'jack' consistently fails.

Answer:

This error is a known bug in MySQL. To resolve it, follow these steps:

  1. Assume the user exists and drop it:

    DROP USER 'jack'@'localhost';
  2. Flush MySQL privileges:

    FLUSH PRIVILEGES;
  3. Create the user:

    CREATE USER 'jack'@'localhost' IDENTIFIED BY 'test123';

This workaround should recreate the 'jack' user without the error. Note that you need to replace 'jack' with the desired username and 'test123' with the actual password.

The above is the detailed content of Why Does Recreating MySQL User 'jack'@'localhost' Fail with Error 1396?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn