{"id":3267,"date":"2018-12-31T06:13:31","date_gmt":"2018-12-31T06:13:31","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=3267"},"modified":"2018-12-31T06:13:31","modified_gmt":"2018-12-31T06:13:31","slug":"setting-root-password-for-mysql-server-on-linux","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2018\/12\/31\/setting-root-password-for-mysql-server-on-linux\/","title":{"rendered":"Setting root password for Mysql server on Linux"},"content":{"rendered":"<p>In some Linux installations, installing mysql-server does not prompt for a root password for mysql, thus creating the problem where you either run mysql under sudo or use it without a password. Unfortunately using<\/p>\n<pre>sudo mysqladmin -u root password \"mypassword\"\r\n<\/pre>\n<p>also does not change the root password , mainly because the root user uses auth_sock for authenticating , which does not use the new password settings. The solution is log in to mysql with sudo and run an ALTER USER command:<\/p>\n<pre>sudo mysql\r\nALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypassword';\r\nFLUSH PRIVILEGES<\/pre>\n<p>&nbsp;<\/p>\n<p>Quit Mysql and try logging in with: mysql &#8211;user=root &#8211;password=newpassword. It should work now.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>In some Linux installations, installing mysql-server does not prompt for a root password for mysql, thus creating the problem where you either run mysql under <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2018\/12\/31\/setting-root-password-for-mysql-server-on-linux\/\" title=\"Setting root password for Mysql server on Linux\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":1087,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[298,278],"tags":[],"class_list":["post-3267","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-mysql-2"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=3267"}],"version-history":[{"count":3,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3267\/revisions"}],"predecessor-version":[{"id":3270,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3267\/revisions\/3270"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/1087"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=3267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=3267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=3267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}