{"id":7481,"date":"2018-05-29T09:00:03","date_gmt":"2018-05-29T01:00:03","guid":{"rendered":"http:\/\/rmohan.com\/?p=7481"},"modified":"2018-05-29T09:00:48","modified_gmt":"2018-05-29T01:00:48","slug":"7481","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7481","title":{"rendered":"ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement."},"content":{"rendered":"<h3 class=\"post-title entry-title\">ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.<\/h3>\n<div class=\"post-header\">\n<div class=\"post-header-line-1\"><\/div>\n<\/div>\n<div id=\"post-body-1555061351186499430\" class=\"post-body entry-content\">\n<div dir=\"ltr\">\n<p><b>Create a user in Mysql in linux<\/b><\/p>\n<p>login to mysql as a root<\/p>\n<p><b>mysql -u root -p<\/b><\/p>\n<p>now create user with following command<\/p>\n<p><b>CREATE USER &#8216;testdb&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;test123&#8217;;<\/b><\/p>\n<p>if you got error like below.<\/p>\n<\/div>\n<\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/05\/Capture.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7482\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/05\/Capture.jpg\" alt=\"\" width=\"640\" height=\"51\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/Capture.jpg 640w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/Capture-300x24.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/Capture-150x12.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/Capture-400x32.jpg 400w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">then you have to reset the root password as password policy level in mysql. so simply use the below command to set the password for root in mysql.<br \/>\n<b><br \/>\n<\/b><b>ALTER USER &#8216;root&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;Root@1234&#8217;;<\/b>then it will show like &#8220;Query OK, 0 rows affected (0.00 sec)&#8221;<\/p>\n<p>now try again the step to create user as per the password policy.<\/p>\n<p>If you don&#8217;t want password policy and you want to create user password with some random simple password then follow the step below.<\/p>\n<p>login mysql as root<br \/>\n<b><br \/>\n<\/b><b>mysql -u root -p<\/b><\/p>\n<p>then check the policy status with below command<br \/>\n<b><br \/>\n<\/b><b>SHOW VARIABLES LIKE &#8216;validate_paswword%&#8217;;<\/b><\/p>\n<p>it will show like below image.<\/p>\n<\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/05\/policy.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7483\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/05\/policy.jpg\" alt=\"\" width=\"421\" height=\"201\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy.jpg 421w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy-300x143.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy-150x72.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy-400x191.jpg 400w\" sizes=\"(max-width: 421px) 100vw, 421px\" \/><\/a><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">\n<p>you can see the validate_password_policy in MEDIUM.<\/p>\n<p>now you have to change to LOW. So you can proceed in your own way. Now set the paoly rule in low with following command.<br \/>\n<b><br \/>\n<\/b><b>SET GLOBAL validat_password_policy=LOW;<\/b><\/p>\n<\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/05\/policy2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7484\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/05\/policy2.jpg\" alt=\"\" width=\"391\" height=\"41\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy2.jpg 391w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy2-300x31.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy2-150x16.jpg 150w\" sizes=\"(max-width: 391px) 100vw, 391px\" \/><\/a><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\"><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/05\/policy3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7485\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/05\/policy3.jpg\" alt=\"\" width=\"425\" height=\"203\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy3.jpg 425w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy3-300x143.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy3-150x72.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/05\/policy3-400x191.jpg 400w\" sizes=\"(max-width: 425px) 100vw, 425px\" \/><\/a><\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">now check the password policy like above. You will get like below image.<\/div>\n<div dir=\"ltr\"><\/div>\n<div dir=\"ltr\">\n<p>mysql&gt; SET GLOBAL validate_password_length = 4;<br \/>\nQuery OK, 0 rows affected (0.01 sec)<\/p>\n<p>mysql&gt; SHOW VARIABLES LIKE &#8216;validate_password%&#8217;;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+<br \/>\n| Variable_name | Value |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+<br \/>\n| validate_password_dictionary_file | |<br \/>\n| validate_password_length | 4 |<br \/>\n| validate_password_mixed_case_count | 1 |<br \/>\n| validate_password_number_count | 1 |<br \/>\n| validate_password_policy | MEDIUM |<br \/>\n| validate_password_special_char_count | 1 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8211;+<br \/>\n6 rows in set (0.00 sec)<\/p>\n<p>mysql&gt; SET GLOBAL validate_password_policy = LOW;<br \/>\nQuery OK, 0 rows affected (0.01 sec)<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"votecell post-layout--left\">\n<div class=\"vote\">Performance schema is not installed by default.<\/div>\n<\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"post-text\">\n<p>For checking, you can run the command<\/p>\n<pre class=\"lang-sql prettyprint prettyprinted\"><code><span class=\"pln\">SHOW VARIABLES <\/span><span class=\"kwd\">LIKE<\/span> <span class=\"str\">'performance_schema'<\/span><span class=\"pun\">;<\/span><\/code><\/pre>\n<p>Suppose, now you will see OFF<\/p>\n<p>To enable it, start the server with the performance_schema variable enabled. For example, use these lines in your my.cnf file:<\/p>\n<pre class=\"lang-sql prettyprint prettyprinted\"><code><span class=\"pun\">[<\/span><span class=\"pln\">mysqld<\/span><span class=\"pun\">]<\/span><span class=\"pln\">\r\nperformance_schema<\/span><span class=\"pun\">=<\/span><span class=\"kwd\">ON<\/span><\/code><\/pre>\n<p>More details you can found in official documentation:<\/p>\n<p><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/en\/performance-schema-quick-start.html\" rel=\"nofollow\">https:\/\/dev.mysql.com\/doc\/refman\/en\/performance-schema-q<\/a><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. <\/p>\n<p>Create a user in Mysql in linux<\/p>\n<p>login to mysql as a root<\/p>\n<p>mysql -u root -p<\/p>\n<p>now create user with following command<\/p>\n<p>CREATE USER &#8216;testdb&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;test123&#8217;;<\/p>\n<p>if you got error like below.<\/p>\n<p> then you have to [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7481"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7481"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7481\/revisions"}],"predecessor-version":[{"id":7487,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7481\/revisions\/7487"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}