ERROR 1396 (HY000): Operation ALTER USER failed for 'Mysql'@'%'

 This MySQL error —

ERROR 1396 (HY000): Operation ALTER USER failed for 'Mysql'@'%'

— means that MySQL cannot find the user 'Mysql'@'%' to alter, or the user definition is inconsistent in the internal privilege tables.

Possible Causes-

1. User doesn’t exist.

The user 'Mysql'@'%' may not exist in the mysql.user table.

2. User exists but has corruption or a mismatch.

Sometimes the internal data becomes inconsistent, especially after an upgrade or manual edits.

3. Privileges issue.

The currently logged-in MySQL user doesn’t have enough privileges to modify other users.

4. MySQL version difference.

The command syntax differs slightly between MySQL 5.7, 8.0, and MariaDB.


Solution-

 Check if user exists 

Run this:

`sql SELECT User, Host FROM mysql.user WHERE User = 'Mysql'; 

` If you get no rows, the user doesn’t exist 

— MySQL can’t “alter” a non-existent account. 

 If the user doesn’t exist, 

create it first 

`sql CREATE USER 'Mysql'@'%' IDENTIFIED BY 'yourpasswordhere'; 

` Then you can alter if needed:

 `sql ALTER USER 'Mysql'@'%' IDENTIFIED BY 'newpasswordhere';

 ` If user exists but still fails Drop and recreate the account cleanly:

 `sql DROP USER 'Mysql'@'%'; CREATE USER 'Mysql'@'%' IDENTIFIED BY 'yourpasswordhere'; ` > 

 Make sure you can safely drop the user — 

This will remove all privileges assigned to it. 

Grant privileges again (if needed) 

`sql GRANT ALL PRIVILEGES ON . TO 'Mysql'@'%' WITH GRANT OPTION; 

FLUSH PRIVILEGES; `

 Note- 

• Check your MySQL version using:

 `sql SELECT VERSION(); ` 

• In MySQL 8.0, 

password updates use: 

 `sql ALTER USER 'Mysql'@'%' IDENTIFIED WITH mysqlnativepassword BY 'new_password'; 

 • Make sure you’re logged in as a user with UPDATE or ALTER USER privilege, such as root` or another admin.


ERROR 1396 (HY000): Operation ALTER USER failed for 'Mysql'@'%'

 This MySQL error — ERROR 1396 (HY000): Operation ALTER USER failed for 'Mysql'@'%' — means that MySQL cannot find the user ...