1396 Error Mysql
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow mysql create user the company Business Learn more about hiring developers or posting ads with us Stack mysql error 1396 drop user Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of mysql show users 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up while creating and deleting user in mysql ERROR 1396 (HY000): Operation CREATE USER up vote 8 down
Mysql Delete User
vote favorite I am trying to create new user in mysql, create user 'saravanakumar'@'localhost' identified by 'saravanakumar'; it shows error as, ERROR 1396 (HY000): Operation CREATE USER failed for 'saravanakumar'@'localhost' after I read this ERROR 1396 (HY000): Operation CREATE USER failed for 'jack'@'localhost' I delete user.But I can't.It shows mysql> SELECT User FROM mysql.user; +---------------+ | User | +---------------+ | root | | saravanakumar | | saravanakumar | | | | root mysql error 1045 | | saravanakumar | | | | root | +---------------+ 8 rows in set (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> SELECT User FROM mysql.user; +---------------+ | User | +---------------+ | root | | saravanakumar | | saravanakumar | | | | root | | saravanakumar | | | | root | +---------------+ 8 rows in set (0.00 sec) how can i delete all these user in table and how can i create a single user.What is the root cause of this problem? experts please help me. mysql share|improve this question edited Sep 2 '13 at 7:27 Barmar 270k23124211 asked Sep 2 '13 at 6:47 saravanakumar 7382824 What does select user, host from mysql.user show? The duplicate users in the table should have different hosts. –Barmar Sep 2 '13 at 7:26 add a comment| 2 Answers 2 active oldest votes up vote 8 down vote accepted ERROR 1396 (HY000): Operation CREATE USER failed for 'saravanakumar'@'localhost' Does indeed indicate that the user already exists or did exist. FLUSH PRIVILEGES doesn't delete users. Reloads the privileges from the grant tables in the mysql database. The server caches information in memory as a result of GRANT, CREATE USER, CREATE SERVER, and INSTALL PLUGIN statements. This memory is not release
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack mysql grant Overflow the company Business Learn more about hiring developers or posting ads with us
Mysql List Users
Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community
Mysql Error 1396 Create User Failed
of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ERROR 1396 (HY000): Operation CREATE USER failed for 'username'@'localhost' IDENTIFIED BY 'mypassword'; up vote 8 down http://stackoverflow.com/questions/18567118/while-creating-and-deleting-user-in-mysql-error-1396-hy000-operation-create-u vote favorite 2 Mistakenly I deleted my root user from my mysql.user table. delete from mysql.user where user='username'; To make same root user, I am trying to fire below query, CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; I get error as ERROR 1396 (HY000): Operation CREATE USER failed for 'username'@'localhost' As per this SO answer, I tried FLUSH PRIVILEGES;, but still I get same error. Any idea what is going wrong? Answer I http://stackoverflow.com/questions/17008610/error-1396-hy000-operation-create-user-failed-for-usernamelocalhost-iden also had to delete the same from mysql.db table delete from mysql.db where user='username'; That's it... mysql user share|improve this question edited Jun 10 '13 at 7:18 asked Jun 9 '13 at 10:20 Fahim Parkar 15.7k2294193 add a comment| 2 Answers 2 active oldest votes up vote 10 down vote accepted If you use DROP USER command to remove the user, then the user gets removed completely. If you have to add user with same username later, you can use FLUSH PRIVILEGES command to completely remove privileges from the mysql memory. DROP USER username@hostname; You have to restart mysql or run FLUSH PRIVILEGES before creating the same user because there are issues with privileges. To restart mysql in linux based systems sudo service mysql restart to restart in windows systems net stop mysql net start mysql To flush privilege in mysql prompt FLUSH PRIVILEGES; You can alternatively use REVOKE command if you know which privileges that the user has REVOKE privillege1, privillege2, ... FROM deleted_user@host share|improve this answer answered Oct 2 '13 at 9:29 Prabhu 1,68921428 add a comment| up vote 1 down vote This user must be referenced in other tables from the mysql system schema. I would recreate the user the same way you deleted it: INSERT INTO mysql.user (user,
here is what usually works if this error happens for user foo delete from mysql.user where user=foo; delete from mysql.db where user=foo Share this:EmailFacebookRedditTwitterLike https://cournape.wordpress.com/2010/08/30/fixing-error-1396-hy000-operation-create-user-failed/ this:Like Loading... Related Post navigation Previous PostRecent progress on bento - build https://bugs.mysql.com/bug.php?id=28331 numpy!Next PostWhat's coming in for bento0.0.4 10 thoughts on “Fixing ERROR 1396 (HY000): Operation CREATE USERfailed” valk says: November 2, 2010 at 11:11 Thank you! This really helped! Reply GWild says: December 17, 2010 at 21:07 Thank you for posting this. Elegant in it's simplicity (not to mention mysql error helpful). Reply TechNazgul says: January 27, 2011 at 05:41 Thanks for posting this. I was stumped trying to recreate a user that I'd (incorrectly) deleted and the 2nd line above did the trick. Thanks. Reply enrico giurin says: March 30, 2011 at 18:58 The reason I had the same error was because I was using: mysql> drop user ‘foo'; rather mysql error 1396 than the correct one: mysql> drop user ‘foo'@"; where some_ip could be for instances…10.2.34.56 I had previously created my user with: mysql> create user ‘foo'@'10.2.34.56' identified by ‘mypassword'; By the way you need to put the user name foo between apex so ‘foo' (not foo) Reply Ryan says: September 26, 2011 at 01:25 In my case this didn't fix it since I already had done this but still got the error. However I also had granted some privileges to the user though so maybe that is why. The user still showed up in the information_schema.USER_PRIVILEGES table. In order to fix it I just had to use the DROP USER statement. Reply Vicent González i Castells says: December 1, 2011 at 01:38 The same case for me. I used DROP USER as solution. Reply Abhishek says: January 2, 2012 at 19:17 i just wrote: drop user foo; and got success for user foo.. Reply D'jems Markenzy Mortimer says: June 3, 2012 at 10:41 Can someone please tell me what's wrong with this syntax for SQL Server version: 5.5.22-0ubuntu1 (
Johan Idrén Email Updates: Status: Verified Impact on me: None Category:MySQL Server: Security: Privileges Severity:S3 (Non-critical) Version:5.0-bk, 5.1-bk OS:Any Assigned to: Assigned Account Triage: Triaged: D4 (Minor) View Add Comment Files Developer Edit Submission View Progress Log Contributions [9 May 2007 11:37] Johan Idrén Description: When using CREATE USER to create a user account when it already exists, the error message is very unclear. How to repeat: mysql> create user 'world'; Query OK, 0 rows affected (0.00 sec) mysql> create user 'world'; ERROR 1396 (HY000): Operation CREATE USER failed for 'world'@'%' Suggested fix: mysql> create user 'world'; Query OK, 0 rows affected (0.00 sec) mysql> create user 'world'; ERROR 1396 (HY000): Operation CREATE USER failed for 'world'@'%', user already exists [30 Nov 2007 13:09] Zoltán Zsizsik I got this message even if the user does not exists any more. [16 Jan 2008 10:21] 1_bug_post, _delete_this_profile I found this bug entry while web-searching for ERROR 1396 (HY000). And it lead me to find another case where this error message is confusing; it appears to bork on reserved words also. Test case that includes the word "user"; mysql> CREATE USER spamuser@localhost; ERROR 1396 (HY000): Operation CREATE USER failed for 'spamuser'@'localhost' Test case that keeps "use" but not "user"; mysql> CREATE USER spamuse@localhost; Query OK, 0 rows affected (0.00 sec) Test case that shows the original length was not the fault; mysql> CREATE USER spamuset@localhost; Query OK, 0 rows affected (0.01 sec) Which now explains why this was working at 3am this morning when I was using single letter descriptors ;-) [16 Jan 2008 12:10] 1_bug_post, _delete_this_profile Actually, after more frustrated testing, it seems that the real cause isn't a reserved word - it seems to be a latent entry in the mysql.db table for a user that has been removed from the mysql.user table. Success case; mysql> create user bugme@localhost; Query OK, 0 rows affected (0.00 sec) mysql> drop user bugme@localhost; Query OK, 0 rows affected (0.00 sec) mysql> create user bugme@localhost; Query OK, 0 rows affected (0.00 sec) Alternate success case; mysql> create us